[Tutor] Novice Python Question
S Potter
f8lcoder at hotmail.com
Tue Jul 1 13:51:24 CEST 2008
To whom it may concern;
I am a just experimenting with Python and learning as I go. The majority of my stumbling blocks have been syntax. So with that I must ask a couple of technical albeit probably very simple questions. Hopefully, you may provide me some insight and help me on my way.
Question 1.)
I have dictionary or list containing multiple instances 'duplicate entries' of the same information. Lets say it's a list of addresses and list item i[0] contains city values equal to 'Albany' .
I am using a second list of one element to provide my filter criteria. This list contains only cities with no duplicate entries.
How do I filter my first list based upon the selected position or a variable equal to the value of the selected position from my second list?
Question 2.) If I assign a value to a variable x = "MyVlaue"
How do I put the value of x into a list?
I would think it would be something like:
list[(str(x))]
But I'm not getting the results I expect.
This would probably be considered macro-substitution in other languages but I cannot find reference to this in python.
Your help is greatly appreciated.
Thank you in advanced,
S.
_________________________________________________________________
Making the world a better place one message at a time.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080701/17662590/attachment.htm>
More information about the Tutor
mailing list