list,string,tuple,dictionary之间的转换
类型 | String | List | tuple | dictionary |
---|---|---|---|---|
String | - | list(str), str.split() | tuple() | - |
List | ‘’.join(list_name) | - | tuple() | dict(list) |
tuple | - | list(tuple) | - | dict(tuple) |
dictionary | - | dic.items() | tuple (dic.items()) |
转自:https://blog.csdn.net/YQ1228/article/details/78542035