python开发
global
在函数里面声明全局变量
浮点数保留小数点
round(num,2)
操作配置文件
import configparser
config = configparser.ConfigParser()
config.read(AddresUrl + "\\config.ini", encoding='GB18030')
操作文件
with open(AddresUrl+"\\erverday"+time2+".txt", 'a', encoding='utf-8') as f:
f.write(times+" "+text+"\n")
f.close()
调用post和get
date={
"finshdate":times,
"thing":thingid,
"flag":falg,
"token":token if 1 else 0
}
head={
"token":token
}
jsons = requests.post(host+"/generator/plog/save", json=date,headers=head).text