阅读背景:

python3 字典、列表、数组和字符串之间的相互转化_JohnieLi的博客

来源:互联网 
  • 字典
  • # -*- coding: UTF-8 -*-
    
    dict_1 = {'1': 'a', '2': 'b', '3': 'c'}
    print(dict_1)  # 打印字典
    print(type(dict_1))  # 打印新赋值的字典的类型
    
    print(str(dict_1), end='字符串\n')  # 把字典转化成字符串后打印
    
    print(tuple(dict_1), end='元组\n')  # 把字典转化为元组后打印
    
    print(list(dict_1), end='列表\n')  # 把字典转化为列表后打印
    
    
    # -*- coding: UTF-8 -*-
    
    dict_



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: