+ 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)
1 Answer
+ 2
You can use sort method
info.sort()
#index 3 out of range, may you mean info[2]