Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open ('file.txt', 'r')
- arr = []
- l=0
- f = file.readline()
- while f:
- templist = f.split()
- name = templist[0] + ' ' + templist[1]
- birthday = templist[2]
- passday = templist[3]
- stat = templist[4] + ' | ' + templist[5] + ' | ' + templist[6]
- average = (int(templist[4]) + int(templist[5]) + int(templist[6]))/3.0
- arr.append([name, birthday, passday, stat, average])
- f = file.readline()
- l+=1
- arr.sort(key = lambda l: l[2].split('.')[2]+l[2].split('.')[1]+l[2].split('.')[0], reverse=1)
- for i in arr:
- print("%10s | %3s | %3s | %10s -> %5f" % (i[0], i[1], i[2], i[3], i[4]))
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement