String concatenation vs. string formatting
steve+comp.lang.python at pearwood.info
Sun Jul 10 15:42:48 CEST 2011
Andrew Berg wrote:
> How should I go about switching from concatenation to string formatting
> for this?
> avs.write(demux_filter + field_filter + fpsin_filter + i2pfilter +
> dn_filter + fpsout_filter + trim_filter + info_filter)
> I can think of a few ways, but none of them are pretty.
fields = (demux_filter, field_filter, fpsin_filter, i2pfilter,
dn_filter, fpsout_filter, trim_filter, info_filter)
avs.write("%s"*len(fields) % fields)
works for me.
More information about the Python-list