Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38725 > unrolled thread
| Started by | contro opinion <contropinion@gmail.com> |
|---|---|
| First post | 2013-02-12 13:12 +0800 |
| Last post | 2013-02-11 21:43 -0800 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
how to call shell? contro opinion <contropinion@gmail.com> - 2013-02-12 13:12 +0800
Re: how to call shell? Tim Roberts <timr@probo.com> - 2013-02-11 21:43 -0800
| From | contro opinion <contropinion@gmail.com> |
|---|---|
| Date | 2013-02-12 13:12 +0800 |
| Subject | how to call shell? |
| Message-ID | <mailman.1682.1360645931.2939.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
>>> import os
>>> os.system("i=3")
0
>>> os.system("echo $i")
0
>>>
why i can't get the value of i ?
[toc] | [next] | [standalone]
| From | Tim Roberts <timr@probo.com> |
|---|---|
| Date | 2013-02-11 21:43 -0800 |
| Message-ID | <1gljh819iupmdr555ni58b6htoi9l3a5u8@4ax.com> |
| In reply to | #38725 |
contro opinion <contropinion@gmail.com> wrote:
>
>>>> import os
>>>> os.system("i=3")
>0
>>>> os.system("echo $i")
>
>0
>>>>
>why i can't get the value of i ?
Each invocation of os.system creates a brand new shell that starts, runs,
and terminates. Your first command adds a variable "i" to the environment
for that shell, but the variable is deleted when the shell procsess
terminates.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web