[Tutor] newbie: Reading text file
Duncan Gibson
duncan at thermal.esa.int
Fri Jun 1 09:17:01 CEST 2007
> I have a text file (mylist.py actually), it contains exactly below:
> ---------------
> # file mylist.py
> jobs = [
> 'Lions',
> 'SysTest',
> 'trainDD',
> 'Cats',
> 'train',
> 'sharks',
> 'whale',
> ]
> ----------------
>
> I want to write another script and get the list "jobs" from the above
> script.
I assume you mean in another python script? Try:
import mylist
print mylist.jobs
More information about the Tutor
mailing list