Newbie: executing a system command from my Python app

Donn Cave donn at
Tue Dec 13 17:12:56 EST 2005

In article <pan.2005. at>,
 Dan M <dan at> wrote:
(quoting someone)
> > 4. If you only have one argument, you don't need a tuple
> > for string formatting. 
> > 5. "(dateYest)" is not a tuple anyway--the parentheses are
> > superfluous 6. Single item tuples can be created with "(anitem,)"
> > (notice the comma).
> That helps. I had somehow gotten the mistaken idea that string formatting
> always needed a tuple, and overlooked the trailing comma. I've applied
> that correction to several of my other Python scripts as well.

Doesn't always need a tuple, but does need a tuple if the
parameter to be converted is already a tuple.  So the tuple
isn't exactly gratuitous.  In fact in a way it makes your code
more polymorphic, which is said to bring good luck.

When you're sure that the expression that appears there on the
right hand side of % is not and will never be a tuple, then
the (a,) one-tuple is unnecessary.  If you aren't sure, it _is_

   Donn Cave, donn at

More information about the Python-list mailing list