开发者

textarea to list

textarea returns this

[u'a\r\nb\r\nc\r\nd\r\ne']

what is the be开发者_C百科st way to turn that into a list

['a', 'b', 'c', 'd', 'e']

Thanks!


>>> L = [u'a\r\nb\r\nc\r\nd\r\ne']
>>> L[0].split('\r\n')
[u'a', u'b', u'c', u'd', u'e']


txtarea = "Thank you for the music\nWelcome to the jungle"
x = txtarea.splitlines()
print(x)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜