[Tutor] String Replacement question
bob gailer
bgailer at gmail.com
Wed May 21 19:16:07 CEST 2008
Faheem wrote:
> Hi all,
> How do I replace the same value multiple times without repeating the
> same variable name/value repeatedly?
> for ex.
>
> some = 'thing'
> print '%s %s %s %s' % (some,some,some,some)
>
> in this case, my question is how do i replace "% (some,some,some)" with
> something more concise?
>
>
The tersest I can offer is:
print '%s %s %s %s' % ((some,)*4)
--
Bob Gailer
919-636-4239 Chapel Hill, NC
More information about the Tutor
mailing list