Python中文
首页
教程
问答
标签
搜索
登录
注册
python c和`while`
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>如果您用<code>python -c</code>开始脚本,有没有方法在<code>while</code>中循环?或者和python的版本无关。。。在</p> <p><strong>Linux</strong></p> <pre><code>[mpenning@Hotcoffee ~]$ python -c "import os;while (True): os.system('ls')" File "<string>", line 1 import os;while (True): os.system('ls') ^ SyntaxError: invalid syntax [mpenning@Hotcoffee ~]$ [mpenning@Hotcoffee ~]$ python -V Python 2.6.6 [mpenning@Hotcoffee ~]$ uname -a Linux Hotcoffee 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux [mpenning@Hotcoffee ~]$ </code></pre> <p><strong>窗口</strong></p> ^{pr2}$ <p>我尝试过删除<code>while</code>语句中的括号,但似乎没有任何东西能使此运行。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>不知道windows,如果你只想输入一行代码,你可以考虑在引号内换行:</p> <pre><code>% python -c "import os; while (True): os.system('ls')" </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
Python中是否有类似Clojure的线程宏?
8 回答
Python中是否有类似JPanel的组件?
1 回答
Python中是否有类似MATLAB的vpasolve的等价解算器
5 回答
python中是否有类似NLTK的东西不需要安装?
8 回答
python中是否有类似osgi在java中试图解决的需求?
10 回答
python中是否有类似PAM的模块?
7 回答
Python中是否有类似Perl的Data::Dumper的工具用来检查数据结构?
6 回答
python中是否有类似robocy的函数,带有重试选项?
1 回答
Python中是否有类似Rstudio的帮助部分?
6 回答
python中是否有类似ruby的索引方法?
8 回答
python中是否有类似于“perlpe”选项的内容?
10 回答
Python中是否有类似于C++ STL映射的结构?
2 回答
python中是否有类似于C中预处理器行为的工具?
10 回答
Python中是否有类似于Harmony的let关键字的内容?
2 回答
python中是否有类似于matlab中fzero的函数?
1 回答
python中是否有类似于MATLAB中peaks(N)的函数/实现?
7 回答
Python中是否有类似于Matlab的deconvblind的函数?
1 回答
Python中是否有类似于Perl中“想要”的东西
5 回答
Python中是否有类似于Perl正则表达式中的"local"变量?
3 回答
python中是否有类似于php的$$变量的语法
5 回答