python字符串与列表的相互转换
2018-02-14 11:58
387 查看
学习内容:
1.字符串转列表
2.列表转字符串
1. 字符串转列表
s ='hello python !'
li = s.split(' ') #注意:引号内有空格
print (li)
输出:
['hello', 'python', '!']
2. 列表转字符串
li = ['hello', 'python', '!'] s = ' '.join(li) #注意:引号内有空格 print(s) 输出: hello python !
相关文章推荐
- python字符串列表字典相互转换
- python 字符串,列表,元组,字典相互转换
- python中字符串和列表的相互转换
- python基础学习——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- python 中list(列表),tupe(元组),str(字符串),dict(字典)之间的相互转换
- python列表,元组,字典和字符串之间的相互转换
- python字符串、列表、字典相互转换
- python 字符串,列表,元组,字典相互转换
- python基础数据结构——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- python中列表,元组,字典,字符串相互转换
- 收集: python中列表,元组,字符串 相互转换, IO 数据处理,行数据切割
- python中列表元组字符串相互转换
- python - 统计一个字符串中的每一个字符出现了多少次(先将字符串转换为列表再统计)
- python基础-列表、元组、range、列表字符串转换
- JSON的String字符串与Java的List列表对象的相互转换
- python 列表转换成字符串
- JSON的String字符串与Java的List列表对象的相互转换
- python 列表转换成字符串输出
- python 二进制和字符串相互转换
- [Python] 十六进制整数与ASCii编码字符串相互转换