Referencing Data structures from a different file?
Thomas Weholt
2002 at weholt.org
Wed Nov 13 15:02:48 EST 2002
in main.py do :
import data_structs
and use the structures like so :
data_structs.your_list.append(1) # or something, and :
data_structs.your_dict['a key'] = 'something'
or :
from data_structs import *
and you can access the structures without prefixing them with the
module-name;
your_list_in_data_structs.append(1)
etc.
"e-tones.co.uk" <admin at e-tones.co.uk> wrote in message
news:3dd2a563$0$28317$fa0fcedb at lovejoy.zen.co.uk...
> Hi all, I have 2 files...
>
> main.py
> data_structs.py
>
> In data_structs I have a list and a dicionary, how do I make it so main.py
> can access these data structures?
>
> Cheers
> Taz
>
>
More information about the Python-list
mailing list