It's too hot & I'm probably being retarded.
>>> "/1/2/3/".split("/")
['', '1', '2', '3','']
Whats with the empty elements at the start and end?
Edit: Thanks all, im putting this down to heat induced brain failure. The docs aren't quite the clearest though, from http://docs.python.org/library/stdtypes.html
"Return a list of the words in the string, using sep as the delimiter string"
Is there a word before the first, or after the last "/"?
Compare with:
"1/2/3".split("/")
Empty elements are still elements.
You could use strip('/')
to trim the delimiter from the beginning/end of your string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With