Parsing a large number of parms to a print statement.
ethan at stoneleaf.us
Thu Oct 22 23:27:12 CEST 2009
> I have to pass over 150 parameters to a print statement ala:
> print "%s <text> %s <other text> %s ....<150'th unique text> %s" % (v
> , v, ... v)
> I can't use a for loop like I normally would over the list "v" due to
> the different text fragments between each var.
> Is there a lambda function I can use in place of '% (v,v...v
> )' ???
> Thanks in advance.
Actually, you are only sending one parameter to print.
Is v iterable? _And_ does v have 150 values? _And_ can you say
tuple(v) and get (v, v, v, ..., v)? If so, try:
print "%s blah %s blah blah %s .... " % tuple(v)
More information about the Python-list