Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added llluiop/0020/2015年05月语音通信.xls
Binary file not shown.
42 changes: 42 additions & 0 deletions llluiop/0020/phonecalls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python
#-*- coding: utf-8-*-


import xlrd


def phone_calls(file_path):
xls = xlrd.open_workbook(file_path)
sheet = xls.sheet_by_index(0)

minutes = 0
seconds = 0

for i in range(1, sheet.nrows):
call = str(sheet.row_values(i)[3].encode("gb2312"))
if "��" in call:
minute, second_phrase = call.split("��")
else:
minute = 0
second_phrase = call

second, tmp = second_phrase.split("��")

minutes += int(minute)
seconds += int(second)

return minutes, seconds



if __name__ == '__main__':
minutes, seconds = phone_calls("2015��05������ͨ��.xls")

minutes += seconds / 60
seconds = seconds % 60
print "ͨ��ʱ���ܼƣ�", minutes, "��", seconds, "��"