Re: [Tutor] Trickier exercise: convert string to complex number

2009-07-10 Thread Lie Ryan
Angus Rodgers wrote: > Wesley Chun, /Core Python Programming/, Ex. 6-13: > > "[...] An atoc() was never implemented in the string module, so > that is your task here. atoc() takes a single string as input, > a string representation of a complex number [...] and returns > the equivalent comple

Re: [Tutor] Trickier exercise: convert string to complex number

2009-07-10 Thread Rich Lovely
On 11 Jul 2009, at 03:15, Angus Rodgers wrote: Wesley Chun, /Core Python Programming/, Ex. 6-13: "[...] An atoc() was never implemented in the string module, so that is your task here. atoc() takes a single string as input, a string representation of a complex number [...] and returns the eq

[Tutor] Trickier exercise: convert string to complex number

2009-07-10 Thread Angus Rodgers
Wesley Chun, /Core Python Programming/, Ex. 6-13: "[...] An atoc() was never implemented in the string module, so that is your task here. atoc() takes a single string as input, a string representation of a complex number [...] and returns the equivalent complex number object with the given va

Re: [Tutor] thesaurus

2009-07-10 Thread ALAN GAULD
> right now, but Chinese apparently has no distinct verb forms for past, > present, > future. So they rely on other words to indicate which they might mean. Chinese also has the problem of relying on intonation to distinguish between identically spelled words. We have the same in English

Re: [Tutor] Searching backwards from end of string

2009-07-10 Thread Robert Berman
On Fri, 2009-07-10 at 20:55 +0100, Angus Rodgers wrote: > On Fri, 10 Jul 2009 11:57:21 -0400, Robert Berman > wrote: > > >I think you are looking for a complex solution. > > Hardly. In my opinion your code w was overly complex for what you were attempting to do. I would not be so presumptuous

Re: [Tutor] My code to update database

2009-07-10 Thread Emile van Sebille
On 7/10/2009 1:03 PM Eduardo Vieira said... On Fri, Jul 10, 2009 at 12:51 PM, Emile van Sebille wrote: On 7/10/2009 11:29 AM Eduardo Vieira said... Hello! I have the code below to update a database from a csv file. I have tested one time and it has worked fine, but I'm a bit fearful that it sho

Re: [Tutor] My code to update database

2009-07-10 Thread Eduardo Vieira
On Fri, Jul 10, 2009 at 12:51 PM, Emile van Sebille wrote: > On 7/10/2009 11:29 AM Eduardo Vieira said... >> >> Hello! I have the code below to update a database from a csv file. I >> have tested one time and it has worked fine, but I'm a bit fearful >> that it should work right as I am updating a

Re: [Tutor] Searching backwards from end of string

2009-07-10 Thread Angus Rodgers
On Fri, 10 Jul 2009 11:57:21 -0400, Robert Berman wrote: >I think you are looking for a complex solution. Hardly. >How about the following example: > > >In [31]: s1='abcdeefghijkl' #find last 'e' > >In [32]: s2=s1[::-1]#reverses s1 > >In [33]: j=s2.find('e') #finds first 'e' in reversed st

Re: [Tutor] My code to update database

2009-07-10 Thread Emile van Sebille
On 7/10/2009 11:29 AM Eduardo Vieira said... Hello! I have the code below to update a database from a csv file. I have tested one time and it has worked fine, but I'm a bit fearful that it should work right as I am updating a database and don't want to cause troubles into the system. Is this code

[Tutor] My code to update database

2009-07-10 Thread Eduardo Vieira
Hello! I have the code below to update a database from a csv file. I have tested one time and it has worked fine, but I'm a bit fearful that it should work right as I am updating a database and don't want to cause troubles into the system. Is this code safe for my personal use? the update code is i

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread daychilde
: > self.fh.close : > : > Which doesn't show where the vars come from, but I am closing the : file : > first. : : Actually, no, it doesn't. You forgot the () which are needed to : actually _call_ the close method on the last line. : :self.fh.close : : is an expression which evaluate

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread Emile van Sebille
On 7/10/2009 10:24 AM daychi...@gmail.com said... : Actually it sounds like you're calling it iteratively, not recursively. :blush: Indeed. : From what you write in here, my first thought is that the ini file : isn't being flushed out to disk before the subprocess starts up and : tries to rea

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread Steve Willoughby
On Fri, Jul 10, 2009 at 12:22:24PM -0500, daychi...@gmail.com wrote: > self.filename = 'bsf.ini' > self.fullpath = self.thispath + self.filename > self.fh = open(self.fullpath, 'w') > self.fh.write(self.bsf_ini) > self.fh.close > > Which doesn't show where t

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread daychilde
: Actually it sounds like you're calling it iteratively, not recursively. :blush: Indeed. : From what you write in here, my first thought is that the ini file : isn't being flushed out to disk before the subprocess starts up and : tries to read it. : : Are you either calling .flush() or .close(

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread Bill Campbell
On Fri, Jul 10, 2009, daychi...@gmail.com wrote: >I'm working on a program that calls another program recursively - this other >program reads in ini file and processes it; my program creates a number of >slightly different ini files and calls the other program for each one. > >I can successfully ge

Re: [Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread Steve Willoughby
On Fri, Jul 10, 2009 at 12:00:11PM -0500, daychi...@gmail.com wrote: > I'm working on a program that calls another program recursively - this other Actually it sounds like you're calling it iteratively, not recursively. > I can successfully generate the ini file. The problem is that the other > p

Re: [Tutor] thesaurus - translation, actually

2009-07-10 Thread Paul McGuire
My favorite rendition of this is in the related field of text-to-speech. In early Object Management Group days, OMG conference proceedings were available as transcripts, but there was substantial delay in getting these out. An attempt to automate this with TTS software of the time was discarded q

[Tutor] os.system and/or subprocess.call problem...

2009-07-10 Thread daychilde
I'm working on a program that calls another program recursively - this other program reads in ini file and processes it; my program creates a number of slightly different ini files and calls the other program for each one. I can successfully generate the ini file. The problem is that the other pro

Re: [Tutor] getting image from url

2009-07-10 Thread Amit Sethi
I am sorry, I did not realize the problem was in the location .Ignore the message On Fri, Jul 10, 2009 at 9:19 PM, Emile van Sebille wrote: > On 7/10/2009 8:29 AM Amit Sethi said... >> >> Hi , I am trying to get  images from url >> >> Their is  a  mail relating to it here : >> "http://mail.python.

Re: [Tutor] Searching backwards from end of string

2009-07-10 Thread Robert Berman
I think you are looking for a complex solution. How about the following example: In [31]: s1='abcdeefghijkl' #find last 'e' In [32]: s2=s1[::-1]#reverses s1 In [33]: j=s2.find('e') #finds first 'e' in reversed string In [36]: ind=len(s1)-j-1 #index into s1 where last occurrence of 'e' i

Re: [Tutor] getting image from url

2009-07-10 Thread Emile van Sebille
On 7/10/2009 8:29 AM Amit Sethi said... Hi , I am trying to get images from url Their is a mail relating to it here : "http://mail.python.org/pipermail/python-list/2001-October/108548.html"; but when i followed similar procedure : import urllib fp = urllib.urlopen("http://en.wikipedia.org

[Tutor] Searching backwards from end of string

2009-07-10 Thread Angus Rodgers
I'm probably having a bit of an off-day, so please forgive me if this is a really silly question (even for a beginner in Python)! I'm working through the exercises for Chapter 6 of Wesley Chun's book [incidentally, I tried to append another endorsement to the list, but my use of Python rather than

[Tutor] getting image from url

2009-07-10 Thread Amit Sethi
Hi , I am trying to get images from url Their is a mail relating to it here : "http://mail.python.org/pipermail/python-list/2001-October/108548.html"; but when i followed similar procedure : >>> import urllib >>>fp = >>>urllib.urlopen("http://en.wikipedia.org/wiki/File:Portrait_john_calvin.j

Re: [Tutor] thesaurus

2009-07-10 Thread Dave Angel
Kent Johnson wrote: On Fri, Jul 10, 2009 at 7:08 AM, Dave Angel wrote: Alan Gauld wrote: Or the translation program that translated the expression Out of sight, out of mind from English to Russian and back with the result: Invisible, lunatic Or the expression: "The

Re: [Tutor] thesaurus

2009-07-10 Thread Kent Johnson
On Fri, Jul 10, 2009 at 7:08 AM, Dave Angel wrote: > Alan Gauld wrote: >> Or the translation program that translated the expression >> >> Out of sight, out of mind >> >> from English to Russian and back with the result: >> >> Invisible, lunatic > Or the expression: > "The spirit is willing, but t

Re: [Tutor] thesaurus

2009-07-10 Thread Dave Angel
Alan Gauld wrote: "Angus Rodgers" wrote parsing these two sentences: Time flies like an arrow. Fruit flies like a banana. Or the translation program that translated the expression Out of sight, out of mind from English to Russian and back with the result: Invisible, lunatic Alan G.