Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39015 > unrolled thread
| Started by | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| First post | 2013-02-17 00:00 -0700 |
| Last post | 2013-02-17 00:00 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: call from pthon to shell Jason Friedman <jsf80238@gmail.com> - 2013-02-17 00:00 -0700
| From | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| Date | 2013-02-17 00:00 -0700 |
| Subject | Re: call from pthon to shell |
| Message-ID | <mailman.1882.1361084432.2939.python-list@python.org> |
>>>> import os
>>>> os.system("i=3")
> 0
>>>> os.system("echo $i")
>
> 0
>
> why i can not get the value of i?
Each call to os.system starts a new shell. Think about what would
happen if you opened a terminal and typed:
$ i=3
Then, close that terminal and open a new one. You would not be surprised that
$ echo $i
returns nothing.
And, as mentioned by Andrew, even absent that problem os.system is not
the way to obtain the data you are looking for.
I realize this is now 5 days after you posted ... what were you
ultimately attempting to accomplish?
Back to top | Article view | comp.lang.python
csiph-web