|
From: Oti <oh...@ya...> - 2003-05-01 05:10:02
|
[ Alec Clews ]
> >>> from java.util import Random
> >>> r = Random()
> >>> r.nextInt()
> 1416976808
> >>> from java.lang import Runtime
> >>> java.lang.Runtime.getRuntime().exec("cmd.exe /cecho hello")
> Traceback (innermost last):
> File "<console>", line 1, in ?
> NameError: java
[infra|pwe] > jython
Jython 2.1 on java1.4.1_02 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from java.lang import Runtime
>>> Runtime.getRuntime().exec("cmd.exe /cecho hello")
java.lang.Win32Process@9446e4
>>>
So if you say:
process = Runtime.getRuntime().exec("cmd.exe /cecho hello")
you can grab the output of the process.
On the other hand, os.system() maybe already does it for you:
>>> import os
>>> os.system( "echo hello" )
hello
0
>>>
Best wishes,
Oti.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
|