Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95199
| Path | csiph.com!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'elif': 0.04; 'sys': 0.05; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stdout': 0.09; 'python': 0.10; 'python.': 0.11; 'systems.': 0.11; 'question.': 0.13; 'suggest': 0.15; 'pipes': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stdin': 0.16; 'true:': 0.16; '"you': 0.18; 'url:home': 0.18; '(in': 0.18; 'library': 0.20; 'windows': 0.20; '2015': 0.20; 'aug': 0.20; '%s"': 0.22; 'os,': 0.22; 'pipe': 0.22; 'pass': 0.22; 'import': 0.24; 'unix': 0.24; 'feature': 0.24; 'module': 0.25; 'header:X-Complaints-To:1': 0.26; 'handled': 0.29; 'random': 0.29; 'print': 0.30; 'another': 0.32; '-0700': 0.33; 'particular,': 0.33; 'skip:c 30': 0.35; 'something': 0.35; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'manual': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.40; 'called': 0.40; 'email addr:gmail.com': 0.62; 'more': 0.63; 'information': 0.63; '12:': 0.84; 'complex,': 0.84; 'too...': 0.84; 'dennis': 0.91; 'received:108': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Pipes |
| Date | Sun, 09 Aug 2015 14:17:57 -0400 |
| Organization | IISS Elusive Unicorn |
| References | <d6a3dfe4-8389-463b-ac66-a93f14a91a5e@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 6.00/32.1186 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13.1439144297.3627.python-list@python.org> (permalink) |
| Lines | 147 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1439144297 news.xs4all.nl 2970 [2001:888:2000:d::a6]:54400 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95199 |
Show key headers only | View raw
On Sun, 9 Aug 2015 07:10:50 -0700 (PDT), rogerh906@gmail.com declaimed the
following:
>Just learning Python and have a question.
>
>Is it possible for Python to pass information to another program (in Windows), wait for that program to finish and then resume operating?
>
>It's called a pipe in Unix systems.
>
They are called pipes in Windows too... IF you mean the chaining of one
process's stdout to another process's stdin -- and this feature is handled
by the OS, not Python.
-=-=-=-=- generator.py
import random
import sys
for i in xrange(100): #yes, it's Python 2.7!
sys.stdout.write("%s\n" %
(random.randint(1, 6)
+ random.randint(1, 6)) )
-=-=-=-=- eater.py
import sys
while True:
ln = sys.stdin.readline()
if not ln: break
v = int(ln.strip())
if v == 2:
v = "snake-eyes"
elif v == 12:
v = "boxcars"
print "You rolled %s" % v
-=-=-=-=- console
C:\Users\Wulfraed\Documents\Python Progs>generator | eater
You rolled 6
You rolled 11
You rolled 6
You rolled 5
You rolled 11
You rolled 4
You rolled 4
You rolled 7
You rolled 3
You rolled boxcars
You rolled 9
You rolled 8
You rolled 6
You rolled 7
You rolled 9
You rolled 7
You rolled 3
You rolled 8
You rolled 3
You rolled snake-eyes
You rolled 6
You rolled 9
You rolled snake-eyes
You rolled 7
You rolled 7
You rolled 7
You rolled 10
You rolled 7
You rolled 7
You rolled 7
You rolled 6
You rolled 3
You rolled 9
You rolled 4
You rolled 11
You rolled 6
You rolled 8
You rolled 7
You rolled 6
You rolled 10
You rolled 6
You rolled 8
You rolled 6
You rolled 9
You rolled 6
You rolled boxcars
You rolled 8
You rolled 9
You rolled 9
You rolled 4
You rolled 7
You rolled 5
You rolled 8
You rolled 5
You rolled 11
You rolled 7
You rolled snake-eyes
You rolled 8
You rolled snake-eyes
You rolled 6
You rolled 9
You rolled 6
You rolled 6
You rolled 6
You rolled 10
You rolled 7
You rolled 6
You rolled 8
You rolled 7
You rolled 6
You rolled 6
You rolled 9
You rolled 5
You rolled 5
You rolled 4
You rolled 6
You rolled 4
You rolled 8
You rolled 8
You rolled snake-eyes
You rolled 7
You rolled 5
You rolled 4
You rolled 7
You rolled 6
You rolled 7
You rolled 8
You rolled 8
You rolled 10
You rolled 9
You rolled 5
You rolled 10
You rolled 6
You rolled 8
You rolled 3
You rolled 5
You rolled 5
You rolled 4
You rolled 9
You rolled 8
C:\Users\Wulfraed\Documents\Python Progs>
If you mean something more complex, then I suggest you read the library
manual -- in particular, look for the module "subprocess"
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pipes rogerh906@gmail.com - 2015-08-09 07:10 -0700
Re: Pipes Ian Kelly <ian.g.kelly@gmail.com> - 2015-08-09 11:13 -0600
Re: Pipes rogerh906@gmail.com - 2015-08-09 10:39 -0700
Re: Pipes Ian Kelly <ian.g.kelly@gmail.com> - 2015-08-09 11:52 -0600
Re: Pipes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-09 19:34 +0100
Re: Pipes rogerh906@gmail.com - 2015-08-09 10:55 -0700
Re: Pipes Emile van Sebille <emile@fenx.com> - 2015-08-09 11:51 -0700
Re: Pipes alister <alister.nospam.ware@ntlworld.com> - 2015-08-09 18:55 +0000
Re: Pipes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-09 16:43 -0400
Re: Pipes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-09 22:18 +0100
Re: Pipes Cameron Simpson <cs@zip.com.au> - 2015-08-10 08:27 +1000
RE: Pipes "Clayton Kirkwood" <crk@godblessthe.us> - 2015-08-09 17:44 -0700
Re: Pipes Chris Angelico <rosuav@gmail.com> - 2015-08-10 20:50 +1000
Re: Pipes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-10 14:44 +0100
Re: Pipes rogerh906@gmail.com - 2015-08-10 07:05 -0700
Re: Pipes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-10 15:36 +0100
Re: Pipes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-09 14:17 -0400
Re: Pipes "E.D.G." <edgrsprj@ix.netcom.com> - 2015-08-10 15:43 -0500
Re: Pipes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-10 22:59 +0100
Re: Pipes Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-10 18:41 -0400
Re: Pipes Larry Hudson <orgnut@yahoo.com> - 2015-08-10 21:48 -0700
Re: Pipes Laura Creighton <lac@openend.se> - 2015-08-11 11:07 +0200
Re: Pipes Laura Creighton <lac@openend.se> - 2015-08-11 11:58 +0200
Re: Pipes Tim Golden <mail@timgolden.me.uk> - 2015-08-11 11:15 +0100
csiph-web