[Tutor] sensing EOF in Python 3.1

Wayne Werner waynejwerner at gmail.com
Wed Nov 23 19:43:36 CET 2011


On Wed, Nov 23, 2011 at 12:03 PM, Cranky Frankie
<cranky.frankie at gmail.com>wrote:

> [...]
> The reason why I'm "pickling" is I'm trying to include information on
> Python data structures in the presentaton I'm preparing. [...]
>

In your context why not just use modules?


 # data.py
Qb_dict = {"Montana": ["Joe", "Montana", "415-123-4567",
"joe.montana at gmail.com","Candlestick Park"],
"Tarkington": ["Fran", "651-321-7657", "frank.tarkington at gmail.com",
"Metropolitan Stadidum"],
"Namath": ["Joe", "212-222-7777", "joe.namath at gmail.com", "Shea Stadium"],
"Elway": ["John", "303-9876-333", "john.elway at gmai.com", "Mile High
Stadium"],
"Elway": ["Ed", "303-9876-333", "john.elway at gmai.com", "Mile High
Stadium"],
"Manning": ["Archie","504-888-1234", "archie.manning at gmail.com",
"Louisiana Superdome"],
"Staubach": ["Roger","214-765-8989", "roger.staubach at gmail.com",
"Cowboy Stadium"]}

# program.py
from data import Qb_dict
print(Qb_dict)

Then you can put whatever comments or data you want. Just make sure that
you don't name your data.py file the same as something built-in. It's
pretty horrible when you try to 'import random' and it doesn't randint() or
anything else that you're looking for.

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111123/70284987/attachment-0001.html>


More information about the Tutor mailing list