Re: Question on Manipulating List and on Python

2011-09-29 Thread Subhabrata Banerjee
011 11:51 AM > To: python-l...@python.org > Subject: Re: Question on Manipulating List and on Python > > On Fri, Sep 30, 2011 at 2:36 AM, Subhabrata Banerjee > wrote: > > And Python seems faster than C++/Java. It is indeed. I also experience > > it. > >

RE: Question on Manipulating List and on Python

2011-09-29 Thread Prasad, Ramit
-Original Message- From: python-list-bounces+ramit.prasad=jpmorgan@python.org [mailto:python-list-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of Chris Angelico Sent: Thursday, September 29, 2011 11:51 AM To: python-list@python.org Subject: Re: Question on Manipulating

Re: Question on Manipulating List and on Python

2011-09-29 Thread John Gordon
In <71c71a9d-928d-4ebe-af64-674c31bc1...@e9g2000vby.googlegroups.com> Subhabrata Banerjee writes: > Hi John, > The actual code is till now is: > def name_debugger(n): > open_file=3Dopen("/python27/name1.txt") > for line in open_file: > line_word=3Dline.split() > #print l

Re: Question on Manipulating List and on Python

2011-09-29 Thread Chris Angelico
On Fri, Sep 30, 2011 at 2:36 AM, Subhabrata Banerjee wrote: > And Python seems faster than C++/Java. It is indeed. I also experience > it. > Python compared to Java? Difficult to compare. Python to C++? Impossible to compare. But performance depends MASSIVELY on algorithmic quality; if you code t

Re: Question on Manipulating List and on Python

2011-09-29 Thread David
> word1=line_word[0] > if word1==001: You are comparing a string and an integer assuming you are reading a text file. integers word1=int(line_word[0]) if word1=1: strings word1=line_word[0] if word1=="001:" -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on Manipulating List and on Python

2011-09-29 Thread Laurent Claessens
Le 29/09/2011 18:27, John Gordon a écrit : In Subhabrata Banerjee 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"] What about creating a dictiona

Re: Question on Manipulating List and on Python

2011-09-29 Thread Subhabrata Banerjee
On Sep 29, 9:27 pm, John Gordon wrote: > In > Subhabrata Banerjee 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 r

Re: Question on Manipulating List and on Python

2011-09-29 Thread Chris Rebert
On Thu, Sep 29, 2011 at 9:11 AM, Subhabrata Banerjee wrote: > 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",

Re: Question on Manipulating List and on Python

2011-09-29 Thread John Gordon
In Subhabrata Banerjee 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: >