小册名称:Python合辑4-130个字符串操作示例
将字符串拆分为多个字符串
s = 'str1, str2, str3, str4'l = s.split(', ')print(l)
s = 'str1, str2, str3, str4'
l = s.split(', ')
print(l)
Output:
['str1', 'str2', 'str3', 'str4']