清秋2018

导航

2020年8月27日 #

python05篇 json和函数

摘要: 一、json json就是一个字符串,只不过是所有语言能解析这个字符串。1.1 把python的数据类型转为json import json d = {'name': 'xiaohei', 'cars': [1, 2, 3], 'house': (4, 5, 6), 'addr': '北京'} # 阅读全文

posted @ 2020-08-27 22:50 清秋2018 阅读(170) 评论(0) 推荐(0)

python04篇 文件操作(二)、集合

摘要: 一、文件操作(二) 1.1 利用with来打开文件 # with open ,python 会自动关闭文件 with open('a.txt', encoding='utf-8') as f: # f 文件句柄 # 文件中没有空行,下面按行读是没问题,如果有空行就不能往下读 while True: 阅读全文

posted @ 2020-08-27 21:52 清秋2018 阅读(177) 评论(0) 推荐(0)