I need newbie help

Joseph Davidson jhd at radix.net
Thu May 13 20:15:36 EDT 2004


I am an experienced perl programmer learning python ( no commente please 
).

In looking at a sample script at 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/269708

I found the following code snippet.
--------------------------------------------------
location = 'myHome'  
fileLocation = {'myHome'   :path1,
                'myOffice' :path2,
                'somewhere':path3}[location] 

-----------------------------------------------------

It seems that this is setting up fileLocation  as a dictionary, but what 
is the "[location]" doing?

Joe Davidson

-- 



More information about the Python-list mailing list