Re: Python newbie question re Strings and integers

2008-09-22 Thread Bruno Desthuilliers
rmac a écrit : Ah! Arghh!!! You are so correct on the usage of the ':' Python syntax is a little different from what I am used to. I don't know what you're used to, but chances are that more than the syntax differs !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python newbie question re Strings and integers

2008-09-20 Thread Bruno Desthuilliers
rmac a écrit : the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) rfind returns an int, so passing it to the int type constructor is useless. filenameStart = int(filename.rfind('/')) idem #print 'Extension Start - ' +

Re: Python newbie question re Strings and integers

2008-09-18 Thread rmac
Ah! Arghh!!! You are so correct on the usage of the ':' Python syntax is a little different from what I am used to. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python newbie question re Strings and integers

2008-09-18 Thread Miki
>     currentSymbol=filename[int(filenameStart),int(extensionStart)] Should be currentSymbol=filename[int(filenameStart):int(extensionStart)] (change , to :) You don't need to convert to int all the time, rfind will return an integer. Also you can use os.path for this from os.path import

Re: Python newbie question re Strings and integers

2008-09-18 Thread Christian Heimes
rmac wrote: the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) filenameStart = int(filename.rfind('/')) #print 'Extension Start - ' + str(extensionStart) #print 'FileName Start - ' + str(filenameStart) currentSymbol=f

Python newbie question re Strings and integers

2008-09-18 Thread rmac
the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) filenameStart = int(filename.rfind('/')) #print 'Extension Start - ' + str(extensionStart) #print 'FileName Start - ' + str(filenameStart) currentSymbol=filename[int(f