字符串转列表(string to list)
s = 'Hello world'
s = [x for x in s]
列表转字符串(list to string)
s = ['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
s = "".join(s)
字符串转列表(string to list)
s = 'Hello world'
s = [x for x in s]
列表转字符串(list to string)
s = ['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
s = "".join(s)
本文标题:一些你可能不知道的Python操作
本文链接:https://www.haomeiwen.com/subject/yhfrsqtx.html
网友评论