python - Strings before \r not displayed -
i have little problem in python when using
print ",".join(array)
for example, when using array=['dog\r', 'monkey', 'pig']
output looks this:
,monkey,pig
any ideas?
ok guys code istself looks
a = raw_input(">>") ualpha = a.split(",")
now know how remove /r how prevent getting there in first place ?
\r
carriage return character, doing should. string dog\r,monkey,pig
, when print it, looks ,monkey,pig
due \r
(moves cursor beginning of line). try strip carriage return (and other white space) strings:
>>> array=['dog\r', 'monkey', 'pig'] >>> ",".join(s.strip() s in array) dog,monkey,pig
alternatively, if posted code, might able "\r" being on there in first place.
Comments
Post a Comment