Prepending / appending to *args
Nikolai Kirsebom
nikolai at micon.no
Sun Jul 9 15:21:12 EDT 2000
I think I've seen how this is done somewhere, but cannot find it. Could
anyone show me how I in function A below add an argument at the beginning of
the list / at the end of the list which then is supplied to function B.
def A(*args):
pa = 'prepended-argument'
aa = 'appended-argument'
B(pa+args+aa) ''''SYNTAX here ??
def B(*args):
for arg in args:
print arg
A(1,2,3)
-----
Result should be:
'prepended-argument'
1
2
3
'appended-argument'
------------
Thanks for any help
Nikolai
More information about the Python-list
mailing list