2024-04-23 17:40:00 发布
网友
根据manual,raw_input写入标准输出。我有一个小程序(test_raw_input.py):
raw_input
test_raw_input.py
# Test if rawinput writes to stdout or stderr raw_input('This is my prompt > ')
不管我怎么做:
或者
$ python test_raw_input.py 2> xxx
提示总是以xxx结尾。为什么会这样?在
xxx
从你对肯尼特的反应来看,我想你明白了
python test_raw_input.py > xxx
只有第二种用法你不明白:
我认为您遇到了这里描述的行为http://mail.python.org/pipermail/python-dev/2008-January/076446.html,这导致了错误报告http://bugs.python.org/issue1927,其中有一条评论说它在去年9月还没有修复。在
但是,有一个解决方法:从https://groups.google.com/forum/?fromgroups=#!topic/chennaipy/R_VJYNdel-o开始,如果
在使用raw_input之前,行为将如您所期望的那样。在
从你对肯尼特的反应来看,我想你明白了
只有第二种用法你不明白:
^{pr2}$我认为您遇到了这里描述的行为http://mail.python.org/pipermail/python-dev/2008-January/076446.html,这导致了错误报告http://bugs.python.org/issue1927,其中有一条评论说它在去年9月还没有修复。在
但是,有一个解决方法:从https://groups.google.com/forum/?fromgroups=#!topic/chennaipy/R_VJYNdel-o开始,如果
^{3}$在使用
raw_input
之前,行为将如您所期望的那样。在相关问题 更多 >
编程相关推荐