Re: Discussion on some Code Issues

2012-07-16 Thread subhabangalore
On Sunday, July 8, 2012 10:47:00 PM UTC+5:30, Chris Angelico wrote: On Mon, Jul 9, 2012 at 3:05 AM, lt;subhabangal...@gmail.comgt; wrote: gt; On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: gt;gt; On Sun, Jul 8, 2012 at 3:42 PM, lt;subhabangal...@gmail.comgt; wrote:

Re: Discussion on some Code Issues

2012-07-09 Thread Chris Angelico
On Mon, Jul 9, 2012 at 10:57 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 Jul 2012 07:54:47 +1000, Chris Angelico wrote: It's like the difference between reminder text on a Magic: The Gathering card and the actual entries in the Comprehensive Rules. Perfect

Re: Discussion on some Code Issues

2012-07-09 Thread Steven D'Aprano
On Mon, 09 Jul 2012 18:41:28 +1000, Chris Angelico wrote: Does it really hurt to anthropomorphize Don't anthropomorphise computers. They don't like it when you do. and say that Python looks for modules in the directories in sys.path instead of Module lookup consists of iterating blah blah

Re: Discussion on some Code Issues

2012-07-09 Thread Chris Angelico
On Mon, Jul 9, 2012 at 10:24 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But it does depend on context. Sometimes you need more detail than just Python looks. You need to know precisely *how* Python looks, and how it decides whether it has found or not. Agreed. So, looking

Re: Discussion on some Code Issues

2012-07-08 Thread Chris Angelico
On Sun, Jul 8, 2012 at 3:42 PM, subhabangal...@gmail.com wrote: Thanks for pointing out the mistakes. Your points are right. So I am trying to revise it, file_open=open(/python32/doc1.txt,r) for line in file_open: line_word=line.split() print (line_word) Yep. I'd be

Re: Discussion on some Code Issues

2012-07-08 Thread subhabangalore
On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: On Sun, Jul 8, 2012 at 3:42 PM, subhabangal...@gmail.com wrote: Thanks for pointing out the mistakes. Your points are right. So I am trying to revise it, file_open=open(/python32/doc1.txt,r) for line in file_open:

Re: Discussion on some Code Issues

2012-07-08 Thread Chris Angelico
On Mon, Jul 9, 2012 at 3:05 AM, subhabangal...@gmail.com wrote: On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: On Sun, Jul 8, 2012 at 3:42 PM, subhabangal...@gmail.com wrote: file_open=open(/python32/doc1.txt,r) Also, as has already been mentioned: keeping your data

Re: Discussion on some Code Issues

2012-07-08 Thread Roy Smith
In article mailman.1922.1341767824.4697.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: open(doc1.txt,r) Python will look for a file called doc1.txt in the directory you run the script from (which is often going to be the same directory as your .py program). Well, to pick a

Re: Discussion on some Code Issues

2012-07-08 Thread MRAB
On 08/07/2012 18:17, Chris Angelico wrote: On Mon, Jul 9, 2012 at 3:05 AM, subhabangal...@gmail.com wrote: On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: On Sun, Jul 8, 2012 at 3:42 PM, subhabangal...@gmail.com wrote: file_open=open(/python32/doc1.txt,r) Also, as has

Re: Discussion on some Code Issues

2012-07-08 Thread Chris Angelico
On Mon, Jul 9, 2012 at 4:17 AM, Roy Smith r...@panix.com wrote: In article mailman.1922.1341767824.4697.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: open(doc1.txt,r) Python will look for a file called doc1.txt in the directory you run the script from (which is often going

Re: Discussion on some Code Issues

2012-07-08 Thread Steven D'Aprano
On Mon, 09 Jul 2012 07:54:47 +1000, Chris Angelico wrote: It's like the difference between reminder text on a Magic: The Gathering card and the actual entries in the Comprehensive Rules. Perfect example is the Madness ability - the reminder text explains the ability, but uses language that

Re: Discussion on some Code Issues

2012-07-07 Thread subhabangalore
On Thursday, July 5, 2012 4:51:46 AM UTC+5:30, (unknown) wrote: Dear Group, I am Sri Subhabrata Banerjee trying to write from Gurgaon, India to discuss some coding issues. If any one of this learned room can shower some light I would be helpful enough. I got to code a bunch of

Re: Discussion on some Code Issues

2012-07-07 Thread subhabangalore
On Sunday, July 8, 2012 2:21:14 AM UTC+5:30, Dennis Lee Bieber wrote: On Sat, 7 Jul 2012 12:54:16 -0700 (PDT), subhabangal...@gmail.com declaimed the following in gmane.comp.python.general: But I am bit intrigued with another question, suppose I say:

Re: Discussion on some Code Issues

2012-07-06 Thread Peter Otten
subhabangal...@gmail.com wrote: [Please don't top-post] start = 0 for match in re.finditer(r\$, data): end = match.start() print(start, end) print(data[start:end]) start = match.end() That is a nice one. I am thinking if I can write for lines in f sort of code that is

Re: Discussion on some Code Issues

2012-07-05 Thread Peter Otten
subhabangal...@gmail.com wrote: On Thursday, July 5, 2012 4:51:46 AM UTC+5:30, (unknown) wrote: Dear Group, I am Sri Subhabrata Banerjee trying to write from Gurgaon, India to discuss some coding issues. If any one of this learned room can shower some light I would be helpful enough. I

Re: Discussion on some Code Issues

2012-07-05 Thread subhabangalore
Dear Peter, That is a nice one. I am thinking if I can write for lines in f sort of code that is easy but then how to find out the slices then, btw do you know in any case may I convert the index position of file to the list position provided I am writing the list for the same file we are

Discussion on some Code Issues

2012-07-04 Thread subhabangalore
Dear Group, I am Sri Subhabrata Banerjee trying to write from Gurgaon, India to discuss some coding issues. If any one of this learned room can shower some light I would be helpful enough. I got to code a bunch of documents which are combined together. Like, 1)A Mumbai-bound aircraft with

Re: Discussion on some Code Issues

2012-07-04 Thread Steven D'Aprano
On Wed, 04 Jul 2012 16:21:46 -0700, subhabangalore wrote: [...] I got to code a bunch of documents which are combined together. [...] The task is to separate the documents on the fly and to parse each of the documents with a definite set of rules. Now, the way I am processing is: I am

Re: Discussion on some Code Issues

2012-07-04 Thread Rick Johnson
On Jul 4, 6:21 pm, subhabangal...@gmail.com wrote: [...] To detect the document boundaries, I am splitting them into a bag of words and using a simple for loop as, for i in range(len(bag_words)):         if bag_words[i]==$:             print (bag_words[i],i) Ignoring that you are attacking

Re: Discussion on some Code Issues

2012-07-04 Thread subhabangalore
On Thursday, July 5, 2012 4:51:46 AM UTC+5:30, (unknown) wrote: Dear Group, I am Sri Subhabrata Banerjee trying to write from Gurgaon, India to discuss some coding issues. If any one of this learned room can shower some light I would be helpful enough. I got to code a bunch of