[Tutor] if statement
Sean 'Shaleh' Perry
shalehperry@attbi.com
Tue, 30 Jul 2002 10:39:31 -0700 (PDT)
On 30-Jul-2002 Kelly, Phelim wrote:
> Hi,
> hoping you can help me.... I'm trying to create an if statement that
> works if a certain string contains a specified 4 characters. Basically I
> want to quit the program if an imported file is a .jpg file, so I'm looking
> for an if statement kind of like:
>
> if filename contains ".jpg": (I'm looking for correct syntax for this
> bit)
> sys.exit()
>
>
import os.path
base, ext = os.path.splitext(filename)
if ext == '.jpg':
handle jpg file
>
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any attachment
> and all copies and inform the sender. Thank you.
>
um, this message prevents any online site from storing you email for later
searching. It is rather impolite.