Nov-02-2019, 11:23 AM
Is it possible to get the values out of a namedtuple that has been stored as a text file?
I am able to get the values out when the namedtuple is first made but, after storing it that approach fails.
Thanks for any help
some.txt file
I am able to get the values out when the namedtuple is first made but, after storing it that approach fails.
Thanks for any help
some.txt file
HighScores(name='aname', score=850) HighScores(name='anothername', score=230) HighScores(name='yetanother', score=50)This bit works when creating the file but, not after being stored in a text file
HighScores = namedtuple("HighScores", "name score") name = HighScores(name, score) print(getattr(name, "name"))
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts