Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Python only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Member List
Calendar
Today's Posts
Home
Forum
Topic
Python
Piping external commands
Piping external commands
Collapse
This topic is closed.
X
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
saibotorama@gmail.com
#1
Piping external commands
Jul 18 '06, 12:45 AM
What is the Python translation for this Bash statement:
tar cf - "${files[@]}" | bzip2 "$file".tar .bz2
(Ignoring the fact that "tar cjf" also exists...)
In other words, how does one pipe together arbitrary commands?
Simon Forman
#2
Jul 18 '06, 05:35 PM
Re: Piping external commands
saibotorama@gma il.com
wrote:
What is the Python translation for this Bash statement:
>
tar cf - "${files[@]}" | bzip2 "$file".tar .bz2
>
(Ignoring the fact that "tar cjf" also exists...)
>
In other words, how does one pipe together arbitrary commands?
For piping subcommands check out the subprocess module, especially
http://docs.python.org/lib/node242.html
, for bzip2 check out the bz2
module
http://docs.python.org/lib/module-bz2.html
, but note, there's
also a tarfile module
http://docs.python.org/lib/module-tarfile.html
which can handle bzip2 as well.
HTH,
~Simon
Comment
Post
Cancel
Previous
template
Next
Working...
OK
OK
Cancel
👍
👎
☕
Comment