I have a string which looks similar to 123456 \\RE1NUM=987
and I have been trying to split it \\RE1NUM=
.
I have tried .split("\\RE1NUM=")
and it gives ['123456 \\', '987']
. I believe forward slashes are being interpreted as escape characters.
The final list I need will be ['123456 ', '987']
.
CodePudding user response:
Can you try to use a different editor? cause I have tried to use the python shell in my terminal and it did indeed give me the desired output as follows
CodePudding user response:
string = "123456 \RE1NUM=987" result = string.split("\\RE1NUM=") print(result)