开发者

textarea to list

开发者 https://www.devze.com 2023-01-22 17:06 出处:网络
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

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

精彩评论

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