随笔分类 - python
摘要:import json a={'4': 5, '6': 7} print(json.dumps(a, sort_keys=True, indent=4)) 输出 { "4": 5, "6": 7 }
阅读全文
摘要:#coding=utf-8 import requests import time import json url="http://xxx/companies" payload={"companyName":"test产废单位10081934","companyType":2,"companyLinkman":"小明","companyPhone":"13111112222","addr...
阅读全文
摘要:#coding=utf-8 import requests import json #获取联单编号 def get_liandan_code(url,producer_code): url=url+"/bc/orders/manual/"+producer_code r = requests.post(url) assert r.json()['code']==...
阅读全文
摘要:参考: https://www.cnblogs.com/caicaihong/p/5687522.html http://www.pythonclub.org/python-network-application/urlencode https://www.cnblogs.com/jessicaxu
阅读全文
摘要:import sys import os sys.path.append("/".join(os.path.dirname(os.path.abspath(__file__)).split("/")[:-1])) from util.getinfolib import getinfo import lib.requests print(getinfo().url) r=requests.get(g
阅读全文
摘要:import yaml import os yaml.warnings({'YAMLLoadWarning': False}) filepath = "/".join(os.path.dirname(os.path.abspath(__file__)).split("/")) + "/hostname.yaml" # 写入yaml 文件 # a 追加写入,w,覆盖写入 fw = open(file
阅读全文
摘要:#计算当前时间 import datetime datetime.datetime.now() # 2019-06-30 10:51:14.089271 # 格式化时间 datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 2019-06-30 10:52:05 #多加(减)一天 (datetime.datetime.now()...
阅读全文
摘要:>>> import datetime >>> >>> i = datetime.datetime.now() >>> print(i.year,i.month,i.day,i.hour,i.minute,i.second) 2020 12 22 06 12 26 >>>
阅读全文
摘要:''' filelist=os.listdir("./report") for i in filelist: if("container" in i): pass else: with open("./report/"+i, 'r') as f: data = json.load(f) if(data["uuid"]=="fac37dfe-c253-458c-96be-820a5b42d589")
阅读全文
摘要:参考: https://www.jianshu.com/p/020709b130d3
阅读全文
摘要:python中单引号和双引号是等效的 字符串过长需要换行时,使用\,如 helloworld\ helloworld 或者是直接使用'''(也可以用来注释),如 '''hello world''' 输出let's go的方法 >>> 'let\'s go' "let's go" >>> "let's go" "let's go" >>> ''
阅读全文
摘要:输出 参考: https://www.cnblogs.com/strivepy/p/10436213.html https://www.cnblogs.com/jfl-xx/p/8024596.html https://www.runoob.com/python/func-number-choice
阅读全文
摘要:code 整理后 参考: https://blog.csdn.net/qq562029186/article/details/81203893
阅读全文
摘要:excel code
阅读全文
摘要:#27 import_company def test_import_company(self): headers=self.headers headers["Content-Type"]="multipart/form-data; boundary WebKitFormBoundarywknEiWB8ukxAa0zz" #获取导入模版 file_home = self.import_templa
阅读全文
摘要:headers=self.headers #获取导入模版 file_home = self.import_template log.info(file_home) wb = load_workbook(filename=file_home) ws = wb['sheet1'] # 修改产废单位名称,以及备注 ws['b3'] = 'itest产废单位'+self.dic["t"] ws['s3']
阅读全文
摘要:pip install requests-toolbelt
阅读全文
摘要:#coding=utf8 import time import os def fileTime(file): l=[time.ctime(os.path.getatime(file)),time.ctime(os.path.getctime(file)),time.ctime(os.path.getmtime(file))] return l print("...
阅读全文
摘要:调用命令 参考: https://www.cnblogs.com/landhu/p/9910460.html
阅读全文

浙公网安备 33010602011771号