file cycle
# Author:Alex
# Date:2017.06.07
# Version:3.6.0
with open('james.txt') as jaf:
data = jaf.readline()
james = data.strip().split(',')
# james.sort()
with open('julie.txt') as jul:
data = jul.readline()
julie = data.strip().split(',')
# julie.sort()
with open('sarah.txt') as sar:
data = sar.readline()
sarahs=data.strip().split(',')
# sarahs.sort()
with open('mikey.txt') as mik:
data = mik.readline()
mikeys=data.strip().split(',')
def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return (time_string)
(mins,secs) = time_string.split(splitter)
return (mins + '.' + secs)
clean_james = []
clean_julie = []
clean_mikeys = []
clean_sarah = []
for each_t in james:
clean_james.append(sanitize(each_t))
for each_t in julie:
clean_julie.append(sanitize(each_t))
for each_t in mikeys:
clean_mikeys.append(sanitize(each_t))
for each_t in sarahs:
clean_sarah.append(sanitize(each_t))
print (sorted(clean_james))
print (sorted(clean_julie))
print (sorted(clean_mikeys))
print (sorted(clean_sarah))
行走感受清淡美,快步的小风
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步