Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path = 'talk.txt' #pathを書き換えてください
- with open(path,encoding='utf-8') as f:
- lines = f.readlines()
- lines_strip = [line.strip() for line in lines]
- l_call = [line for line in lines_strip if '☎ 通話時間 ' in line]
- timeSum = 0
- for callLog in l_call:
- timeText = callLog.split('☎ 通話時間 ')[1]
- time = reversed(timeText.split(':'))
- n=0
- for i in time:
- timeSum += int(i)*(60**n)
- n+=1
- print(timeSum/3600,"hour")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement