trailing newline in string.splitfields()
astrophels at yahoo.com
Tue Sep 3 16:17:10 CEST 2002
I was splitting up some fields in a textfile using string.split, which
works fine, but that it usee ' ' as the delimiter. I've found that some
of the things I want to split include a space or two, so I've gone to
using string.splitfields, which also works fine, but for one thing.
Unlike string.split() it also grabs the newlne('\n') at the end of each
The way I've worked around this is as such:
var1,var2,var3 = string.splitfields(stringtosplit,',')
So, I slice of the character, easy enough. And I'm generally satisfied
with that - but I was wondering if there may be, for the cause of more
beautiful code, a way to tell string.splitfields() to do it automatically.
More information about the Python-list