Python中几种常见数据结构的相互转换:字符串(str)、字典(dict)、列表(list)。
一、字符串–列表
字符串转列表
1.使用内置函数 list()
![461ac50b8f41c612f25c47a31b8dbc56.png](https://img-blog.csdnimg.cn/img_convert/461ac50b8f41c612f25c47a31b8dbc56.png)
2.使用内置函数 eval()
![7b29884defec6622787935d550322834.png](https://img-blog.csdnimg.cn/img_convert/7b29884defec6622787935d550322834.png)
3.使用内置模块 json.loads() 方法
![00908aa01df46c372c7137bcf4180cca.png](https://img-blog.csdnimg.cn/img_convert/00908aa01df46c372c7137bcf4180cca.png)
4.使用 split() 进行分割
![7eeafd2165ec446dbd74e324da18b57f.png](https://img-blog.csdnimg.cn/img_convert/7eeafd2165ec446dbd74e324da18b57f.png)
如果我们要对
Python中几种常见数据结构的相互转换:字符串(str)、字典(dict)、列表(list)。
字符串转列表
1.使用内置函数 list()
2.使用内置函数 eval()
3.使用内置模块 json.loads() 方法
4.使用 split() 进行分割
如果我们要对