I've just noticed that you can use the import statement to import variables,
such that a simple file such as vars.py:

# File with predefined variables
var1= 'some text'
var2= 2
var3=['a','b','c']

Would then, upon import, provide:

>>>vars.var1
'some text'
>>>vars.var2
2
>>>vars.var3
['a','b','c']

This is great, I had no idea! However, is there then a way to reassign or
update the values? For instance, can you say:

>>>vars.var1='some new text'

??

Just curious!
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to