[Tutor] if statement

Einar Th. Einarsson einarth@decode.is
Tue, 30 Jul 2002 17:22:13 +0000


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

something like:

import os.path

if( os.path.splitext(filename)[1] =3D=3D ".jpg):
    sys.exit(0)


- --=20
 "One of the symptoms of an approaching nervous breakdown is the
belief that one's work is terribly important."
                -- Bertrand Russell

Yours etc.
    Einar Th.

On Tuesday 30 July 2002 17:13, 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 looki=
ng
> for an if statement kind of like:
>
> if filename contains ".jpg":        (I'm looking for correct syntax for
> this bit)
>    sys.exit()
>
>
>
>
> can this be done?? hope so!!
>
> thanks
>
> Phelim.
>
>
> 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 copie=
d,
> 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.
>
> =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor


-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBPUbLRW1/ORZtyd/tEQKO/ACgiKJWwjTxQR+ds8yAWJWJYEkAOrsAoIVh
SOvnvMaPVg2A0ah3lmcEdb4a
=3DiHBz
-----END PGP SIGNATURE-----