1、列表與字符串轉(zhuǎn)換
列表轉(zhuǎn)字符串:
將列表中的內(nèi)容拼接成一個字符串
image
將列表中的值轉(zhuǎn)成字符串
image
字符串轉(zhuǎn)列表:
用eval轉(zhuǎn)換
image
將字符串每個字符轉(zhuǎn)成列表中的值
image
將字符串按分割成列表
image
2族铆、列表與字典轉(zhuǎn)換
列表轉(zhuǎn)字典:
將兩個列表轉(zhuǎn)成字典
image
將嵌套列表轉(zhuǎn)為字典
image
字典轉(zhuǎn)列表:
字典中鍵岩四、值轉(zhuǎn)為列表
image
3、字典與字符串轉(zhuǎn)換
字符串轉(zhuǎn)字典:
用eval轉(zhuǎn)換
image
用json.loads 轉(zhuǎn)換
image
字典轉(zhuǎn)字符串:
用json.dumps 轉(zhuǎn)換
image
強(qiáng)轉(zhuǎn)換
image