Skip to content
Advertisement

extracting info from a text file in python

I am making a system in which when a user plays my game, it compares their score to what they have scored before by using a username and password. the info is stored in text file in the format: score*username*password. I am trying to get those into different variables so that I can check them against other variables. this is the code I’m using. the problem is that the assigning of the variables doesn’t work and I cant work out why

JavaScript

Advertisement

Answer

Its much more efficient (and easy) to use json

using the following as file.json

JavaScript
JavaScript

the file is now

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement