Google Answers Logo
View Question
 
Q: Python - File open 'Read' ( No Answer,   0 Comments )
Question  
Subject: Python - File open 'Read'
Category: Computers > Algorithms
Asked by: macca1111-ga
List Price: $10.00
Posted: 17 Oct 2006 23:44 PDT
Expires: 19 Oct 2006 05:11 PDT
Question ID: 774591
Hi,

If I have a text file called suits.txt

nameA,1,2,3,4
nameB,1,2,0,0

The numbers after the nameA identify what the person can do.  For
instance, 1=Run, 2=Walk etc.

I need to read the file, then access each name (nameA, nameB...) and
then use the numbers to identify what they can do.

So..

nameA can 'run'(1), 'walk'(2), 'skip'(3), 'talk'(4)
nameB can 'run'(1), 'walk'(2), but can't ship or talk due to the
variable being 0's.

Regards

Clarification of Question by macca1111-ga on 18 Oct 2006 00:25 PDT
I was thinking that maybe it would be better to load the data into a Dictionary.

That way I only need to access one variable ie the dictionary name and
then the name can be the locator...  I could then take each number
after the name for my calculations etc.

Would anyone know how to load the data into a Dictionary and then be
able to print the name and manipulate each number after wards.

Hope this is clear.

For example is the dictionary has a name then 4 numbers after it
{'macca ga':1,2,3,4} how would I readthe data into the dictionary and
then have access to them???

Tks
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy