Newbie asks, how to get rid of the last four characters of a string?

Christopher Culver kricxjo.neniuspamajxo at yahoo.com
Wed Jan 22 15:46:31 CET 2003


On Wed, 22 Jan 2003 15:33:16 +0100, Max M wrote:
> You can just use a slice.
> 
> 'filename.doc'[:-4]
> 
>  >>> filename
> 
> regards Max M

That was just what I was looking for, thanks!

Christopher Culver




More information about the Python-list mailing list