How to import or include data structures (e.g. a dict) into a Python file from a separate file

Solution 1:

Just import it

import myDict
print myDict.airportCode

or, better

from myDict import airportCode
print airportCode

Just be careful to put both scripts on the same directory (or make a python package, a subdir with __init__.py file; or put the path to script.py on the PYTHONPATH; but these are "advanced options", just put it on the same directory and it'll be fine).

Solution 2:

Assuming your import myDict works, you need to do the following:

from myDict import airportCode