一些你可能不知道的Python操作

字符串转列表(string format to list format)

s = 'Hello world'
s = [x for x in s]

列表转字符串(list format to string format)

s = ['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
s = "".join(s)

猜你喜欢

转载自blog.csdn.net/weixin_34355715/article/details/87396561