骄傲的赛亚人

列表字符串互转


1. 字符串转列表


str1 = "hi hello world" print(str1.split(" "))
输出:
['hi', 'hello', 'world']

2. 列表转字符串

l = ["hi","hello","world"]
print(" ".join(l))
输出:
hi hello world

posted on 2019-12-05 16:32  骄傲的赛亚人  阅读(194)  评论(0编辑  收藏  举报

导航