摘要: # Auther: Aaron Fan# 动态获取执行文件的相对路径路径:print(__file__)#动态获取执行文件的绝对路径:import osfile_path = os.path.abspath(__file__)print(file_path)#返回目录名,不要文件名(返回的是一个路径 阅读全文
posted @ 2016-12-14 00:53 范恒 阅读(415) 评论(0) 推荐(0) 编辑
摘要: # Auther: Aaron Fan# 加载文件中的数据import jsonwith open('test.txt','r',encoding='utf-8') as f: info = json.loads(f.read())print(info) 阅读全文
posted @ 2016-12-14 00:52 范恒 阅读(212) 评论(0) 推荐(0) 编辑
摘要: # Auther: Aaron Fan# 把数据存入到一个文件中# json格式的数据几乎可以通用语任何编程语言,但是仅仅只是简单的格式转换# 比如:字典、列表、元组、字符串这些,像函数、类就不可以这么转换了。# python中有一个支持所有格式转换的模块:pickle,但是pickle格式不能用用 阅读全文
posted @ 2016-12-14 00:51 范恒 阅读(1062) 评论(0) 推荐(0) 编辑