Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def writeVars(*args)
- File = open("heroSave.py","w")
- var_name = lambda x:[ n for n in globals() if id(globals()[n]) == id(x) ][0]
- for stats in args:
- if ( type(stats) == int or type(stats) == float ):
- File.write(var_name(stats)+" = ")
- File.write(str(stats)+"\n")
- elif ( type(stats) == str ):
- File.write(var_name(stats)+" = ")
- File.write("\""+stats+"\""+"\n")
- File.close()
- x,y,z = 1,2,3
- writeVars(x,y,z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement