> Can I use string formatting in my own functions, or is it stuck with
> builtins?
No, you can use it too.
> It doesn't make much sense for me, but I don't understand the following
> error:
> In [2]: def printd(arg):
> ...: print('>>> %s') % arg
The format operator needs to be with the
> The parenthesization you had earlier forced Python into printing out
> your template before it had an opportunity to plug arg into it. You
> need to do the interpolation first.
Gaaah. Brain freeze.
I was pointing at the wrong code. *grin*
I meant to look at the other statement that you h
On Sat, 15 Apr 2006, Tiago Saboga wrote:
> 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
> .
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('Variab