[Zope] string module

Bill Anderson bill@libc.org
13 Jun 2001 10:55:04 -0600


On 13 Jun 2001 07:47:13 -0700, Sebal wrote:
> I have a method what from a "MULTIPART FORM" put a file named 'myFile.pdf'
> in a directory.
> And after i want the methood to create a Zclass instance[PDFclass] whith
> id=myFile.
> 
> I tried  with split, join, and translate method of string module, and I
> can't get a valid id with split and join ; and with translate if 'myFile' is
> 'mypdf' (so the file is 'mypdf.pdf') I'll get 'my' as id for my PDFclass
> instance.


Split on the '.' not on 'pdf'.

Example from the interpreter:
>>> foo="mypdf.pdf"
>>> id,extension = string.split(foo,'.')
>>> print id
mypdf

Bill