工作日的努力python_python计算上班时间的问题
展開全部
import?datetime
import?codecs
def?read_time(str_x,str_s):
a=str_x.split('????')
date_x=datetime.datetime.strptime(a[1],'%Y-%m-%d?%H:%M:%S')
a=str_s.split('????')
date_s=datetime.datetime.strptime(a[1],'%Y-%m-%d?%H:%M:%S')
d=date_x?-?date_s
shangb_d?=?a[1].split('?')
return?a[0]+'??'+str(d.total_seconds())+'??'+a[2].strip()+?'??'+shangb_d[0]
fp=codecs.open('zhidao_1.txt','r','utf-8')
f_w=codecs.open('results.txt','w','utf-8')
for?line_xiab?in?codecs.open('zhidao_2.txt','r','utf-8'):
line_shangb?=?fp.readline()
a?=?read_time(line_xiab,line_shangb)
f_w.write(a+'\n')
fp.close()
f_w.close()
沒人回答我就回答一個(gè)吧,其e5a48de588b662616964757a686964616f31333337383933實(shí)還是學(xué)學(xué)基礎(chǔ)比較好,可以看看云課堂上的用Python做些事,上面變量章節(jié)對(duì)日期變量和文件變量講解可以滿足你的需求。
總結(jié)
以上是生活随笔為你收集整理的工作日的努力python_python计算上班时间的问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python简单超级马里奥游戏下载_py
- 下一篇: oracle语句转成mysql语句_如何