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:

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

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support