+ 2

File lines question

File contains 3 rows of names. How can I print it out so it’s in ascending order of surname? Thank you and please explain For row in file: Info = row.split(“,”) Username=info[0] Firstname=info[1] Surname=info[3] Print(username, firstname, surname)

12th Feb 2022, 9:25 PM
Darkpidgeon 14
1 Answer
+ 2
You can use sort method info.sort() #index 3 out of range, may you mean info[2]
12th Feb 2022, 9:51 PM
Jayakrishna 🇼🇳