Nov-29-2022, 08:34 PM
(This post was last modified: Nov-29-2022, 08:34 PM by deanhystad.)
There is only one split here. This creates a list of str objects by splitting the string at each backslash.
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.
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.