Reputation: 1022
I have a .txt
file and this is my lines:
1 word word \\123\\3456\\0000
the delimiter is .split('\t')
and I expected the following list:
[1, 'word', 'word', '\\123\\3456\\0000']
but on my last character the split method is returning:
'\\\\123\\\\3456\\\0000'
with two more '\\'
Does anyone know where is my mistake?
Upvotes: 1
Views: 89
Reputation: 8982
That is just a representation of a string, double backslash means one backslash.
If you try to print it, it will appear correctly
>>> for i in s.split('\t'):
... print(i)
...
1
word
word
\\123\\3456\\0000
Upvotes: 4