Oct-03-2017, 06:53 PM
A simple way to do it is just write it tab separated:
with open('character.txt', 'w') as character_file: character_file.write('str\t{}\n'.format(str)) character_file.write('dex\t{}\n'.format(dex)) ...Then you can load them:
with open('character.txt') as character_file: for line in character_file: attribute, value = line.split() if attribute == 'str': str = int(value) ...Two pieces of advice: learn classes (there's a link to a tutorial in my signature, below) and upgrade to Python 3.6.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures