それは言う
james.append(sanitize(each_item))
(mins, secs) = time_string.split(splitter)
need more than 1 value to unpack
どうしたの?ありがとうございました。Head First Pythonでの例です
james = []
def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = '-'
else:
splitter = ','
(mins, secs) = time_string.split(splitter)
return(mins + '.' + secs)
with open('james.txt', 'r') as jaf:
data = jaf.readline()
james_data = data.strip().split(',')
for each_item in james_data:
james.append(sanitize(each_item))
sort(james)
print(james)