2011-04-26

Python: How to remove \n (end of line) symbol

# -*- coding: utf-8 -*-
str = [u"afaaas\n", "adasf \t"]
print "withouth strip():", str
print "with strip:\n", str[0].strip()
print str[1].strip()

as you can see .strip() also remove \t

Комментариев нет:

Отправить комментарий