摘要: 1 #author F 2 3 import os 4 import sys 5 print(__file__) #相对路径 6 print(os.path.abspath(__file__)) #绝对路径 7 print(os.path.dirname(os.path.abspath(__file__))) 8 print(os.path.dirname(os.path.di... 阅读全文
posted @ 2017-06-20 16:40 Bird_getUpEarly 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 import pickle 2 def say(): 3 print("hello One") 4 info = { 5 "test1":"111111", 6 "test2":"222222", 7 "test3":say #pickle可以dump函数(内存地址) 8 } 9 f = open("test.txt", "wb") 10 p... 阅读全文
posted @ 2017-06-20 16:04 Bird_getUpEarly 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1 #json序列化和反序列化 2 ''' 3 info = { 4 'name': 'AxiBa', 5 'sex': 'male' 6 } 7 f = open('test.txt', 'a', encoding="utf-8") 8 f.write(str(info)) 9 f.close() 10 ''' 11 import json 12 info =... 阅读全文
posted @ 2017-06-20 15:20 Bird_getUpEarly 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 #author F 2 3 #内置函数 4 print(abs(-5)) #绝对值 5 print(all([0, -5, 13])) #如果可迭代对象都为真 返回true 如果有不为真 返回false 6 print(any([0, -5, 13])) #如果有一个对象为真 返回true 如果都不为真 返回false 7 print(any([]))... 阅读全文
posted @ 2017-06-20 11:35 Bird_getUpEarly 阅读(178) 评论(0) 推荐(0) 编辑