Python Forum
extract only text strip byte array
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
extract only text strip byte array
#6
There is only one split here. This creates a list of str objects by splitting the string at each backslash.
A = str(msg)
B = A.split('\\')
This is indexing. This gets the last str in the list.
C = B[-1]
This is a slice. This gets a slice that starts at index 3 and ends at the last character (does not include last character)
txt = C[3:-1]
Being "the worst at splits" is a temporary condition. Now that you know you are really "the worst at slices" and maybe just a little bad at indexing you can cure that by reading about slicing here.
https://www.askpython.com/python/array/a...-in-python

You really should read about slicing and play around with slicing until you know how it works. It is very useful and your programming will suffer until you know it forward, backward and inside out.
Pir8Radio likes this post
Reply


Messages In This Thread
extract only text strip byte array - by Pir8Radio - Nov-29-2022, 01:41 PM
RE: extract only text strip byte array - by Larz60+ - Nov-29-2022, 06:12 PM
RE: extract only text strip byte array - by deanhystad - Nov-29-2022, 08:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I add comments from a text-file to an array of folders? clausneergaard 2 1,939 Feb-08-2023, 07:45 PM
Last Post: Larz60+
Smile please help me remove error for string.strip() jamie_01 3 1,348 Oct-14-2022, 07:48 AM
Last Post: Pedroski55
  Extract only certain text which are needed Calli 26 6,926 Oct-10-2022, 03:58 PM
Last Post: deanhystad
  Extract text rektcol 6 1,952 Jun-28-2022, 08:57 AM
Last Post: Gribouillis
  Can't strip extra characters from Data Canflyguy 7 2,095 Jan-10-2022, 02:16 PM
Last Post: Canflyguy
  Extract a string between 2 words from a text file OscarBoots 2 1,996 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  Extract text based on postion and pattern guddu_12 2 1,770 Sep-27-2021, 08:32 PM
Last Post: guddu_12
  Extract specific sentences from text file Bubly 3 3,645 May-31-2021, 06:55 PM
Last Post: Larz60+
  extract color text from PDF Maha 0 2,164 May-31-2021, 04:05 PM
Last Post: Maha
Question How to extract multiple text from a string? chatguy 2 2,547 Feb-28-2021, 07:39 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020