例如:
list_string = ["This is a string that I want."
, "this is also a string that I want!"
, "and this"
, "and also this one!!"]
我希望获得的是:
list_string1 = ["This is a string that I want."]
list_string2 = ["this is also a string that I want!"]
list_string3 = ["and this"]
list_string4 = ["and also this one!!"]
我知道有很多关于在 stackoverflow 中拆分 python 字符串的问题,但是我还没有在这里找到我的问题的答案。这甚至可能吗?
如果有人能给我一些意见,我真的很感激,因为我真的想获得一些知识!
检查这个
>>> list_string = ["This is a string that I want."
, "this is also a string that I want!"
, "and this"
, "and also this one!!"]
>>> [[i] for i in list_string]
[['This is a string that I want.'], ['this is also a string that I want!'], ['and this'], ['and also this one!!']]
>>>
您可以使用list_string[0],list_string[1]
等调用单个列表
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句