Question on Manipulating List and on Python

Subhabrata Banerjee subhagurgaon2011 at gmail.com
Thu Sep 29 12:36:29 EDT 2011


On Sep 29, 9:27 pm, John Gordon <gor... at panix.com> wrote:
> In <a6679459-fc57-4389-8d43-1e5ed960d... at y18g2000yqy.googlegroups.com> Subhabrata Banerjee <subhagurgaon2... at gmail.com> writes:
>
> > (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
>
> This isn't your actual code.  Please show us your real code, along with
> a sample of your input file.
>
> > (ii) My second question is posted by one of my colleagues, what makes
> > Python so fast?
>
> Fast compared to what?  Why does your colleague believe it should be
> slower?
>
> --
> John Gordon                   A is for Amy, who fell down the stairs
> gor... at panix.com              B is for Basil, assaulted by bears
>                                 -- Edward Gorey, "The Gashlycrumb Tinies"

Hi John,
The actual code is till now is:

def name_debugger(n):
    open_file=open("/python27/name1.txt")
    for line in open_file:
        line_word=line.split()
        #print line_word
        word1=line_word[0]
        print word1


And Python seems faster than C++/Java. It is indeed. I also experience
it.

Regards,
Subhabrata Banerjee.



More information about the Python-list mailing list