None in string formatting
Erik Max Francis
max at alcyone.com
Wed Mar 9 05:30:24 CET 2005
rodney.maxwell at gmail.com wrote:
> Was doing some string formatting, noticed the following:
>>>> x = None
>>>> "%s" % x
> Is there a reason it maps to 'None'? I had expected ''.
Because %s just calls str on the arguments, and str(None) == 'None'.
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
As far as I'm concerned, being any gender is a drag.
-- Patti Smith
More information about the Python-list