python 零碎知识总结 用法
request 篇:
import requests from urllib import parse data={ 'text':'股票价格', 'desp':s } url_data =parse.urlencode(data) url = "https://sc.ftqq.com/6.send?"+url_data requests.get(url)
IO操作篇:
def write_to_file(content): with open('result.txt','a',encoding='utf-8') as f: f.write(content+"\n")
pandas 篇
for i in range(0, len(df)): s+=df.iloc[i]['code']+" "+df.iloc[i]['name']+" "+df.iloc[i]['price']+"\n"
datetime 日期操作篇:
now = datetime.datetime.now()
sched_Timer = datetime.datetime(now.year, now.month, now.day, 11, 25, 1)
List 篇
list=[]
list.append(item)
Json 篇
json.dumps(lists,ensure_ascii=False)