Apr-05-2018, 05:09 AM
(This post was last modified: Apr-05-2018, 05:10 AM by Gribouillis.)
There are alternatives to the global statement. One of them is to use a class
class Aah: mystring = 'spam' otherstring = 'ham' def main(): print(Aah.mystring) Aah.mystring = 'eggs' print(Aah.mystring) if __name__ == '__main__': main()
Output:spam
eggs