[Tutor] String representation of NULL (non type) values

Ulrich Goebel ml at fam-goebel.de
Mon Nov 4 11:34:01 CET 2013


Hallo,

from a SQLite database I get a value by SELECT s from... which normaly 
is a string, but can be the NULL value, wich means it is not defined. To 
put the value into a form (made by QT) I need a string representation.

str(s) gives either the string itself (which is good) or "None" (which 
is not so good) in the case of NULL. Instead of "None" I would prefer an 
empty string "". How to get that?

Possibly there is a build in function smart(s1, s2, s3,...) which 
returns the first s which is a useable string, or even "" if there isn't 
any string in the arguments?

Thanks for help
Ulrich


-- 
Ulrich Goebel
Paracelsusstr. 120, 53177 Bonn


More information about the Tutor mailing list