摘要:import requestsHEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/
阅读全文
摘要:1. import pymongo client = pymongo.MongoClient(host='localhost',port=27017) 2. client=MongoClient('mongodb://localhost:27017/')
阅读全文
摘要:键操作 字符串操作:支持最基本的键值对形式存储 列表操作:列表内的元素可以重复,而且可以从两端存储 集合操作:集合中的元素都是不重复的 有序集合操作:有序集合比集合多了一个分数字段,利用它可以对集合中的数据进行排序 散列操作:利用name指定一个散列表的名称,表内存储了各个键值对
阅读全文
摘要:连接redis 本地安装了Redis并运行在6379端口,密码设置为 foobared. 1. from redis import StrictRedis redis = StrictRedis(host='localhost',port=6379,db=0,password='foobared')
阅读全文
摘要:def view_bar(num, total): rate = float(num) / float(total) rate_num = int(rate * 100) r = '\r[%s%s]%d%%' % ("="*(rate_num), " "*(100-rate_num), rate_n
阅读全文
摘要:四个部分: test fixture A test fixture represents(代表) the preparation needed to perform one or more tests, and any associate cleanup actions. This may invo
阅读全文
摘要:def encrypt(self,stationId ): keys = 'F29E0E39-98E4-F4CC318443' encrypt_obj = pyDes.triple_des(keys, pyDes.ECB, "\0\0\0\0\0\0\0\0", pad=None, padmode=
阅读全文
摘要:1.字符串转列表 split() str1 = "hi hello world"print(str1.split(" "))输出:['hi', 'hello', 'world'] 2.列表转字符串 " ".join() l = ["hi","hello","world"] #str = " ".jo
阅读全文
摘要:def task(): current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(current_time) coordinate_list = Getlnglat().spyder_list_all() p
阅读全文