How do I turn text doc. information into list? - Raspberry Pi Forums
hi wondering if knows how turn information text document list. trying make list of name , scores highest lowest - score leaderboard. need in list this: scores= [["playerone", 33], ["playertwo", 12], ["playerthree", 45]] can use lambda sort it. @ moment name , score seen 1 piece of information like:
scores=[["playerone 33"], etc.
unable sort score highest lowest.
current coding turning information list is:
scores=[["playerone 33"], etc.
unable sort score highest lowest.
current coding turning information list is:
code: select all
with open("scores.txt", "r") f: scores = [line.strip() line in f]
im total python noob work.
code: select all
scores = [line.strip().split(" ",1) line in f]
raspberrypi
Comments
Post a Comment