Can I use string formatting in my own functions, or is it stuck with builtins? 
It doesn't make much sense for me, but I don't understand the following 
error:

In [1]: var = 456

In [2]: def printd(arg):
   ...:     print('>>> %s') % arg
   ...:

In [3]: printd(var)
>>> 456

In [4]: printd('Variable is %s') % var
>>> Variable is %s
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most recent 
call last)

/home/tiago/<console>

TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'


Thanks,

Tiago.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to