Question on Manipulating List and on Python

Subhabrata Banerjee subhagurgaon2011 at gmail.com
Thu Sep 29 18:11:41 CEST 2011


Dear Group,

I have two questions one on list manipulation and other on Python.

(i) I have a file of lists. Now, the first digit starts with a number
or index, like,

[001, "Obama", "USA", "President"]
[002  "Major", "UK", "PM"]
[003  "Singh", "INDIA", "PM"]

Initially, I am reading the file and taking as
for line in file:
    line_word=line.split
    print line_word

I am getting the above result. But, my problem is if I read the array
position 0, which is a number then it should give me reciprocal words
like
if
word1=line_word[0]
if word1==001:
    I should get line_word[1], line_word[2] reciprocating the value.

Predefining it solves the problem, but I want to capture and do as it
iterates. If any one can help?

(ii) My second question is posted by one of my colleagues, what makes
Python so fast?

Regards,
Subhabrata Banerjee.



More information about the Python-list mailing list