Why use backticks?

Paul Watson pwatson at redlinec.com
Wed May 7 23:15:41 EDT 2003


Yes, but the commands module appears to be UNIX only.

"Jeff Epler" <jepler at unpythonic.net> wrote in message
news:mailman.1052357472.17747.python-list at python.org...
> On Wed, May 07, 2003 at 05:16:38PM -0500, Paul Watson wrote:
> > Backticks in Python do not mean the same thing as they do in Perl.  Your
> > Perl friend would need to do something like:
>
> .. or they could use the commands module.
> >>> commands.getoutput("uname -a")
> 'Linux parrot 2.4.20-9 #1 Wed Apr 2 13:42:50 EST 2003 i686 i686 i386
> GNU/Linux'
>
> I notice this even has the last-newline-stripping feature of Perl's ``.
> (I also don't see how to turn this off, in case the program's output is
> binary...)
>
> Jeff
>






More information about the Python-list mailing list