[Tutor] null string

Boudewijn Rempt boud@valdyas.org
Fri, 26 Oct 2001 22:54:23 +0200


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

On Friday 26 October 2001 22:32, tonycervone wrote:
> How does one check for a null string in an if condition? thanks. tony

Depends on what you think 'null' should be - either compare
it to the None object, or to the empty string:

if s =3D=3D None or s =3D=3D "":
=09print "This might be considered a null string"

This contrasts with systems like the Oracle database,
where a null value can have a type. A real Python null
is always None.

- --=20

Boudewijn Rempt | http://www.valdyas.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE72c2AN8fj6DnPxOgRAhh0AJwJWG9PBT7ZS42FxUEgAAqENfIUjwCgtmcs
HK/u7T2D7WnQ7Z8Etr3vtWc=3D
=3DjBCx
-----END PGP SIGNATURE-----