I\'m having a hard time trying to use .strip with the following line of code.
Thanks for the help.
f.write(re.split(\"Tech ID:|Name:|Account #:\",li
Expand your one liner into multiple lines. Then it becomes easy:
f.write(re.split("Tech ID:|Name:|Account #:",line)[-1]) parts = re.split("Tech ID:|Name:|Account #:",line) wanted_part = parts[-1] wanted_part_stripped = wanted_part.strip() f.write(wanted_part_stripped)