Python论坛  - 讨论区

标题:[python-chinese] 请问:python如何从console读取一个字符

2006年08月10日 星期四 12:55

nuo mi newchar at gmail.com
Thu Aug 10 12:55:58 HKT 2006

我的意思是,只读取一个字符

比如经典场景:  Are you sure?(y/n)

这种情况下如果用raw_input()就必须按y再按回车

如何能不按回车直接读到y?

谢谢^_^
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060810/39a168fd/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月10日 星期四 13:47

刘鑫 march.liu at gmail.com
Thu Aug 10 13:47:19 HKT 2006

正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可以使用内置模块msvcrt。
msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。

在06-8-10,nuo mi <newchar at gmail.com> 写道:
>
>
> 我的意思是,只读取一个字符
>
> 比如经典场景:  Are you sure?(y/n)
>
> 这种情况下如果用raw_input()就必须按y再按回车
>
> 如何能不按回车直接读到y?
>
> 谢谢^_^
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060810/a45aeacf/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月10日 星期四 13:51

nuo mi newchar at gmail.com
Thu Aug 10 13:51:03 HKT 2006

可惜我是linux用户,唉。。。

thanks any way

On 8/10/06, 刘鑫 <march.liu at gmail.com> wrote:
>
> 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可以使用内置模块msvcrt。
> msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
>
> 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> >
> >
> 我的意思是,只读取一个字符
>
> 比如经典场景:  Are you sure?(y/n)
>
> 这种情况下如果用raw_input()就必须按y再按回车
>
> 如何能不按回车直接读到y?
>
> 谢谢^_^
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to   python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> --
> 欢迎访问:
> http://blog.csdn.net/ccat
>
> 刘鑫
> March.Liu
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060810/6a84702b/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月10日 星期四 17:06

nuo mi newchar at gmail.com
Thu Aug 10 17:06:07 HKT 2006

难道linux下没办法实现吗?不可能吧,有谁知道吗?

谢谢


On 8/10/06, nuo mi <newchar at gmail.com> wrote:
>
> 可惜我是linux用户,唉。。。
>
> thanks any way
>
>
> On 8/10/06, 刘鑫 <march.liu at gmail.com> wrote:
> >
> > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可以使用内置模块msvcrt。
> > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
> >
> > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> > >
> > >
> > 我的意思是,只读取一个字符
> >
> > 比如经典场景:  Are you sure?(y/n)
> >
> > 这种情况下如果用raw_input()就必须按y再按回车
> >
> > 如何能不按回车直接读到y?
> >
> > 谢谢^_^
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> >
> > --
> > 欢迎访问:
> > http://blog.csdn.net/ccat
> >
> > 刘鑫
> > March.Liu
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060810/2c4d17aa/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月10日 星期四 17:08

刘鑫 march.liu at gmail.com
Thu Aug 10 17:08:33 HKT 2006

要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……

在06-8-10,nuo mi <newchar at gmail.com> 写道:
>
>
> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
>
> 谢谢
>
>
>
> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
> >
> > 可惜我是linux用户,唉。。。
> >
> > thanks any way
> >
> >
> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
> > >
> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可以使用内置模块msvcrt。
> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
> > >
> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> > > >
> > > >
> > > 我的意思是,只读取一个字符
> > >
> > > 比如经典场景:  Are you sure?(y/n)
> > >
> > > 这种情况下如果用raw_input()就必须按y再按回车
> > >
> > > 如何能不按回车直接读到y?
> > >
> > > 谢谢^_^
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> > >
> > >
> > > --
> > > 欢迎访问:
> > > http://blog.csdn.net/ccat
> > >
> > > 刘鑫
> > > March.Liu
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060810/66e6a6d6/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月11日 星期五 11:36

Leira Hua lhua at altigen.com.cn
Fri Aug 11 11:36:40 HKT 2006

好像是个老问题了吧? 隐约记得05年的时候也有讨论过~

cookbook上有一个~~

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892

On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫  
<march.liu at gmail.com> wrote:

> 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
>
> 在06-8-10,nuo mi <newchar at gmail.com> 写道:
>>
>>
>> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
>>
>> 谢谢
>>
>>
>>
>> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
>> >
>> > 可惜我是linux用户,唉。。。
>> >
>> > thanks any way
>> >
>> >
>> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
>> > >
>> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可 
>> 以使用内置模块msvcrt。
>> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
>> > >
>> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
>> > > >
>> > > >
>> > > 我的意思是,只读取一个字符
>> > >
>> > > 比如经典场景:  Are you sure?(y/n)
>> > >
>> > > 这种情况下如果用raw_input()就必须按y再按回车
>> > >
>> > > 如何能不按回车直接读到y?
>> > >
>> > > 谢谢^_^
>> > >
>> > > _______________________________________________
>> > > python-chinese
>> > > Post: send python-chinese at lists.python.cn
>> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> > > Unsubscribe: send unsubscribe to
>> > > python-chinese-request at lists.python.cn
>> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > 欢迎访问:
>> > > http://blog.csdn.net/ccat
>> > >
>> > > 刘鑫
>> > > March.Liu
>> > >
>> > > _______________________________________________
>> > > python-chinese
>> > > Post: send python-chinese at lists.python.cn
>> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> > > Unsubscribe: send unsubscribe to
>> > > python-chinese-request at lists.python.cn
>> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> > >
>> > >
>> >
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese at lists.python.cn
>> Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月11日 星期五 14:23

nuo mi newchar at gmail.com
Fri Aug 11 14:23:12 HKT 2006

例子代码好像没有效果啊,我再试试

多谢


On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
>
> 好像是个老问题了吧? 隐约记得05年的时候也有讨论过~
>
> cookbook上有一个~~
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
>
> On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫
> <march.liu at gmail.com> wrote:
>
> > 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
> >
> > 在06-8-10,nuo mi <newchar at gmail.com> 写道:
> >>
> >>
> >> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
> >>
> >> 谢谢
> >>
> >>
> >>
> >> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
> >> >
> >> > 可惜我是linux用户,唉。。。
> >> >
> >> > thanks any way
> >> >
> >> >
> >> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
> >> > >
> >> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,可
> >> 以使用内置模块msvcrt。
> >> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
> >> > >
> >> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> >> > > >
> >> > > >
> >> > > 我的意思是,只读取一个字符
> >> > >
> >> > > 比如经典场景:  Are you sure?(y/n)
> >> > >
> >> > > 这种情况下如果用raw_input()就必须按y再按回车
> >> > >
> >> > > 如何能不按回车直接读到y?
> >> > >
> >> > > 谢谢^_^
> >> > >
> >> > > _______________________________________________
> >> > > python-chinese
> >> > > Post: send python-chinese at lists.python.cn
> >> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> > > Unsubscribe: send unsubscribe to
> >> > > python-chinese-request at lists.python.cn
> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > 欢迎访问:
> >> > > http://blog.csdn.net/ccat
> >> > >
> >> > > 刘鑫
> >> > > March.Liu
> >> > >
> >> > > _______________________________________________
> >> > > python-chinese
> >> > > Post: send python-chinese at lists.python.cn
> >> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> > > Unsubscribe: send unsubscribe to
> >> > > python-chinese-request at lists.python.cn
> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> > >
> >> > >
> >> >
> >>
> >> _______________________________________________
> >> python-chinese
> >> Post: send python-chinese at lists.python.cn
> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >>
> >>
> >
> >
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060811/90e45c2c/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月11日 星期五 17:51

Leira Hua lhua at altigen.com.cn
Fri Aug 11 17:51:02 HKT 2006

我这儿都好用,虽然还没来得及回家在Linux下试用,但是在cygwin下OK,用的也使 
termios module

F:\Leira\MyProgs\Python>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on  
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import getch
>>> getch.getch()
'a'
>>> getch.getch()
's'
>>> getch.getch()
'd'

-----------------------------------------

$ ipython
Python 2.4.3 (#1, May 18 2006, 07:40:45)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.2 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import getch

In [2]: getch.getch()
                      Out[2]: 'a'

In [3]:



On Fri, 11 Aug 2006 14:23:12 +0800, nuo mi  
<newchar at gmail.com> wrote:

> 例子代码好像没有效果啊,我再试试
>
> 多谢
>
>
> On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
>>
>> 好像是个老问题了吧? 隐约记得05年的时候也有讨论过~
>>
>> cookbook上有一个~~
>>
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
>>
>> On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫
>> <march.liu at gmail.com> wrote:
>>
>> > 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
>> >
>> > 在06-8-10,nuo mi <newchar at gmail.com> 写道:
>> >>
>> >>
>> >> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
>> >>
>> >> 谢谢
>> >>
>> >>
>> >>
>> >> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
>> >> >
>> >> > 可惜我是linux用户,唉。。。
>> >> >
>> >> > thanks any way
>> >> >
>> >> >
>> >> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
>> >> > >
>> >> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发, 
>>>> >> 以使用内置模块msvcrt。
>> >> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
>> >> > >
>> >> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
>> >> > > >
>> >> > > >
>> >> > > 我的意思是,只读取一个字符
>> >> > >
>> >> > > 比如经典场景:  Are you sure?(y/n)
>> >> > >
>> >> > > 这种情况下如果用raw_input()就必须按y再按回车
>> >> > >
>> >> > > 如何能不按回车直接读到y?
>> >> > >
>> >> > > 谢谢^_^
>> >> > >
>> >> > > _______________________________________________
>> >> > > python-chinese
>> >> > > Post: send python-chinese at lists.python.cn
>> >> > > Subscribe: send subscribe to  
>> python-chinese-request at lists.python.cn
>> >> > > Unsubscribe: send unsubscribe to
>> >> > > python-chinese-request at lists.python.cn
>> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >> > >
>> >> > >
>> >> > >
>> >> > >
>> >> > > --
>> >> > > 欢迎访问:
>> >> > > http://blog.csdn.net/ccat
>> >> > >
>> >> > > 刘鑫
>> >> > > March.Liu
>> >> > >
>> >> > > _______________________________________________
>> >> > > python-chinese
>> >> > > Post: send python-chinese at lists.python.cn
>> >> > > Subscribe: send subscribe to  
>> python-chinese-request at lists.python.cn
>> >> > > Unsubscribe: send unsubscribe to
>> >> > > python-chinese-request at lists.python.cn
>> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >> > >
>> >> > >
>> >> >
>> >>
>> >> _______________________________________________
>> >> python-chinese
>> >> Post: send python-chinese at lists.python.cn
>> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> >> Unsubscribe: send unsubscribe to
>> python-chinese-request at lists.python.cn
>> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >>
>> >>
>> >
>> >
>>
>>
>>
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese at lists.python.cn
>> Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月11日 星期五 18:09

=?ISO-2022-JP?B?RHJlYW1pbmdrKBskQkU3QC4bKEIp?= dreamingk at gmail.com
Fri Aug 11 18:09:39 HKT 2006

我在linux下不能用。

On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
> 我这儿都好用,虽然还没来得及回家在Linux下试用,但是在cygwin下OK,用的也使
> termios module
>
> F:\Leira\MyProgs\Python>python
> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import getch
> >>> getch.getch()
> 'a'
> >>> getch.getch()
> 's'
> >>> getch.getch()
> 'd'
>
> -----------------------------------------
>
> $ ipython
> Python 2.4.3 (#1, May 18 2006, 07:40:45)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.7.2 -- An enhanced Interactive Python.
> ?       -> Introduction to IPython's features.
> %magic  -> Information about IPython's 'magic' % functions.
> help    -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: import getch
>
> In [2]: getch.getch()
>                       Out[2]: 'a'
>
> In [3]:
>
>
>
> On Fri, 11 Aug 2006 14:23:12 +0800, nuo mi
> <newchar at gmail.com> wrote:
>
> > 例子代码好像没有效果啊,我再试试
> >
> > 多谢
> >
> >
> > On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
> >>
> >> 好像是个老问题了吧? 隐约记得05年的时候也有讨论过~
> >>
> >> cookbook上有一个~~
> >>
> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
> >>
> >> On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫
> >> <march.liu at gmail.com> wrote:
> >>
> >> > 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
> >> >
> >> > 在06-8-10,nuo mi <newchar at gmail.com> 写道:
> >> >>
> >> >>
> >> >> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
> >> >>
> >> >> 谢谢
> >> >>
> >> >>
> >> >>
> >> >> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
> >> >> >
> >> >> > 可惜我是linux用户,唉。。。
> >> >> >
> >> >> > thanks any way
> >> >> >
> >> >> >
> >> >> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
> >> >> > >
> >> >> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开发,
> >> 可
> >> >> 以使用内置模块msvcrt。
> >> >> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
> >> >> > >
> >> >> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> >> >> > > >
> >> >> > > >
> >> >> > > 我的意思是,只读取一个字符
> >> >> > >
> >> >> > > 比如经典场景:  Are you sure?(y/n)
> >> >> > >
> >> >> > > 这种情况下如果用raw_input()就必须按y再按回车
> >> >> > >
> >> >> > > 如何能不按回车直接读到y?
> >> >> > >
> >> >> > > 谢谢^_^
> >> >> > >
> >> >> > > _______________________________________________
> >> >> > > python-chinese
> >> >> > > Post: send python-chinese at lists.python.cn
> >> >> > > Subscribe: send subscribe to
> >> python-chinese-request at lists.python.cn
> >> >> > > Unsubscribe: send unsubscribe to
> >> >> > > python-chinese-request at lists.python.cn
> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >> > >
> >> >> > >
> >> >> > >
> >> >> > >
> >> >> > > --
> >> >> > > 欢迎访问:
> >> >> > > http://blog.csdn.net/ccat
> >> >> > >
> >> >> > > 刘鑫
> >> >> > > March.Liu
> >> >> > >
> >> >> > > _______________________________________________
> >> >> > > python-chinese
> >> >> > > Post: send python-chinese at lists.python.cn
> >> >> > > Subscribe: send subscribe to
> >> python-chinese-request at lists.python.cn
> >> >> > > Unsubscribe: send unsubscribe to
> >> >> > > python-chinese-request at lists.python.cn
> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >> > >
> >> >> > >
> >> >> >
> >> >>
> >> >> _______________________________________________
> >> >> python-chinese
> >> >> Post: send python-chinese at lists.python.cn
> >> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> >> Unsubscribe: send unsubscribe to
> >> python-chinese-request at lists.python.cn
> >> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> >>
> >> _______________________________________________
> >> python-chinese
> >> Post: send python-chinese at lists.python.cn
> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >>
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>


-- 
Dreamingk (tc, 天成)
email:
    dreamingk at gmail.com
    tc at exoweb.net
website:
    http://www.exoweb.net
    http://python.cn
    http://django.cn
    http://zope.cn
Exoweb (北京轩辕互动科技有限公司)
  北京市朝阳区金台路甜水园东街2号
  甜水园商务中心A505  100026
Python, I love this language.

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月14日 星期一 09:15

Leira Hua lhua at altigen.com.cn
Mon Aug 14 09:15:56 HKT 2006

我在家里试了,没有问题啊~  我用的是ubuntu-dapper,python 2.4.3, 你呢?

-------------------

Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.1.fix1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import getch

In [2]: getch.getch()
Out[2]: 'a'

In [3]: getch.getch()
Out[3]: 'b'

In [4]: getch.getch()
Out[4]: 'c'

In [5]:



On Fri, 11 Aug 2006 18:09:39 +0800, Dreamingk(天成)  
<dreamingk at gmail.com> wrote:

> 我在linux下不能用。
>
> On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
>> 我这儿都好用,虽然还没来得及回家在Linux下试用,但是在cygwin下OK,用的也 
>> 使
>> termios module
>>
>> F:\Leira\MyProgs\Python>python
>> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import getch
>> >>> getch.getch()
>> 'a'
>> >>> getch.getch()
>> 's'
>> >>> getch.getch()
>> 'd'
>>
>> -----------------------------------------
>>
>> $ ipython
>> Python 2.4.3 (#1, May 18 2006, 07:40:45)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 0.7.2 -- An enhanced Interactive Python.
>> ?       -> Introduction to IPython's features.
>> %magic  -> Information about IPython's 'magic' % functions.
>> help    -> Python's own help system.
>> object? -> Details about 'object'. ?object also works, ?? prints more.
>>
>> In [1]: import getch
>>
>> In [2]: getch.getch()
>>                       Out[2]: 'a'
>>
>> In [3]:
>>
>>
>>
>> On Fri, 11 Aug 2006 14:23:12 +0800, nuo mi
>> <newchar at gmail.com> wrote:
>>
>> > 例子代码好像没有效果啊,我再试试
>> >
>> > 多谢
>> >
>> >
>> > On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
>> >>
>> >> 好像是个老问题了吧? 隐约记得05年的时候也有讨论过~
>> >>
>> >> cookbook上有一个~~
>> >>
>> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
>> >>
>> >> On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫
>> >> <march.liu at gmail.com> wrote:
>> >>
>> >> > 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
>> >> >
>> >> > 在06-8-10,nuo mi <newchar at gmail.com> 写道:
>> >> >>
>> >> >>
>> >> >> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
>> >> >>
>> >> >> 谢谢
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
>> >> >> >
>> >> >> > 可惜我是linux用户,唉。。。
>> >> >> >
>> >> >> > thanks any way
>> >> >> >
>> >> >> >
>> >> >> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
>> >> >> > >
>> >> >> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开 
>> 发,
>> >> 可
>> >> >> 以使用内置模块msvcrt。
>> >> >> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
>> >> >> > >
>> >> >> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
>> >> >> > > >
>> >> >> > > >
>> >> >> > > 我的意思是,只读取一个字符
>> >> >> > >
>> >> >> > > 比如经典场景:  Are you sure?(y/n)
>> >> >> > >
>> >> >> > > 这种情况下如果用raw_input()就必须按y再按回车
>> >> >> > >
>> >> >> > > 如何能不按回车直接读到y?
>> >> >> > >
>> >> >> > > 谢谢^_^
>> >> >> > >
>> >> >> > > _______________________________________________
>> >> >> > > python-chinese
>> >> >> > > Post: send python-chinese at lists.python.cn
>> >> >> > > Subscribe: send subscribe to
>> >> python-chinese-request at lists.python.cn
>> >> >> > > Unsubscribe: send unsubscribe to
>> >> >> > > python-chinese-request at lists.python.cn
>> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >> >> > >
>> >> >> > >
>> >> >> > >
>> >> >> > >
>> >> >> > > --
>> >> >> > > 欢迎访问:
>> >> >> > > http://blog.csdn.net/ccat
>> >> >> > >
>> >> >> > > 刘鑫
>> >> >> > > March.Liu
>> >> >> > >
>> >> >> > > _______________________________________________
>> >> >> > > python-chinese
>> >> >> > > Post: send python-chinese at lists.python.cn
>> >> >> > > Subscribe: send subscribe to
>> >> python-chinese-request at lists.python.cn
>> >> >> > > Unsubscribe: send unsubscribe to
>> >> >> > > python-chinese-request at lists.python.cn
>> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >> >> > >
>> >> >> > >
>> >> >> >
>> >> >>
>> >> >> _______________________________________________
>> >> >> python-chinese
>> >> >> Post: send python-chinese at lists.python.cn
>> >> >> Subscribe: send subscribe to  
>> python-chinese-request at lists.python.cn
>> >> >> Unsubscribe: send unsubscribe to
>> >> python-chinese-request at lists.python.cn
>> >> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>> >>
>> >> _______________________________________________
>> >> python-chinese
>> >> Post: send python-chinese at lists.python.cn
>> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> >> Unsubscribe: send unsubscribe to   
>> python-chinese-request at lists.python.cn
>> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >>
>>
>>
>>
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese at lists.python.cn
>> Subscribe: send subscribe to python-chinese-request at lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年08月14日 星期一 09:43

nuo mi newchar at gmail.com
Mon Aug 14 09:43:49 HKT 2006

换了单位的机器,现在好用了,我再看看,谢谢 ^_^

On 8/14/06, Leira Hua <lhua at altigen.com.cn> wrote:
> 我在家里试了,没有问题啊~  我用的是ubuntu-dapper,python 2.4.3, 你呢?
>
> -------------------
>
> Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.7.1.fix1 -- An enhanced Interactive Python.
> ?       -> Introduction to IPython's features.
> %magic  -> Information about IPython's 'magic' % functions.
> help    -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: import getch
>
> In [2]: getch.getch()
> Out[2]: 'a'
>
> In [3]: getch.getch()
> Out[3]: 'b'
>
> In [4]: getch.getch()
> Out[4]: 'c'
>
> In [5]:
>
>
>
> On Fri, 11 Aug 2006 18:09:39 +0800, Dreamingk(天成)
> <dreamingk at gmail.com> wrote:
>
> > 我在linux下不能用。
> >
> > On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
> >> 我这儿都好用,虽然还没来得及回家在Linux下试用,但是在cygwin下OK,用的也
> >> 使
> >> termios module
> >>
> >> F:\Leira\MyProgs\Python>python
> >> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
> >> win32
> >> Type "help", "copyright", "credits" or "license" for more information.
> >> >>> import getch
> >> >>> getch.getch()
> >> 'a'
> >> >>> getch.getch()
> >> 's'
> >> >>> getch.getch()
> >> 'd'
> >>
> >> -----------------------------------------
> >>
> >> $ ipython
> >> Python 2.4.3 (#1, May 18 2006, 07:40:45)
> >> Type "copyright", "credits" or "license" for more information.
> >>
> >> IPython 0.7.2 -- An enhanced Interactive Python.
> >> ?       -> Introduction to IPython's features.
> >> %magic  -> Information about IPython's 'magic' % functions.
> >> help    -> Python's own help system.
> >> object? -> Details about 'object'. ?object also works, ?? prints more.
> >>
> >> In [1]: import getch
> >>
> >> In [2]: getch.getch()
> >>                       Out[2]: 'a'
> >>
> >> In [3]:
> >>
> >>
> >>
> >> On Fri, 11 Aug 2006 14:23:12 +0800, nuo mi
> >> <newchar at gmail.com> wrote:
> >>
> >> > 例子代码好像没有效果啊,我再试试
> >> >
> >> > 多谢
> >> >
> >> >
> >> > On 8/11/06, Leira Hua <lhua at altigen.com.cn> wrote:
> >> >>
> >> >> 好像是个老问题了吧? 隐约记得05年的时候也有讨论过~
> >> >>
> >> >> cookbook上有一个~~
> >> >>
> >> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
> >> >>
> >> >> On Thu, 10 Aug 2006 17:08:33 +0800, 刘鑫
> >> >> <march.liu at gmail.com> wrote:
> >> >>
> >> >> > 要不?咱拿C自己写一个?在*nix下应该不会很复杂的说……
> >> >> >
> >> >> > 在06-8-10,nuo mi <newchar at gmail.com> 写道:
> >> >> >>
> >> >> >>
> >> >> >> 难道linux下没办法实现吗?不可能吧,有谁知道吗?
> >> >> >>
> >> >> >> 谢谢
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> On 8/10/06, nuo mi <newchar at gmail.com> wrote:
> >> >> >> >
> >> >> >> > 可惜我是linux用户,唉。。。
> >> >> >> >
> >> >> >> > thanks any way
> >> >> >> >
> >> >> >> >
> >> >> >> > On 8/10/06, 刘鑫 < march.liu at gmail.com> wrote:
> >> >> >> > >
> >> >> >> > > 正好在Python英文社区看到一个类似的问题。如果你只在windows上开
> >> 发,
> >> >> 可
> >> >> >> 以使用内置模块msvcrt。
> >> >> >> > > msvcrt.getch()/msvcrt.getche()函数应该可以满足你的需要。
> >> >> >> > >
> >> >> >> > > 在06-8-10,nuo mi < newchar at gmail.com> 写道:
> >> >> >> > > >
> >> >> >> > > >
> >> >> >> > > 我的意思是,只读取一个字符
> >> >> >> > >
> >> >> >> > > 比如经典场景:  Are you sure?(y/n)
> >> >> >> > >
> >> >> >> > > 这种情况下如果用raw_input()就必须按y再按回车
> >> >> >> > >
> >> >> >> > > 如何能不按回车直接读到y?
> >> >> >> > >
> >> >> >> > > 谢谢^_^
> >> >> >> > >
> >> >> >> > > _______________________________________________
> >> >> >> > > python-chinese
> >> >> >> > > Post: send python-chinese at lists.python.cn
> >> >> >> > > Subscribe: send subscribe to
> >> >> python-chinese-request at lists.python.cn
> >> >> >> > > Unsubscribe: send unsubscribe to
> >> >> >> > > python-chinese-request at lists.python.cn
> >> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >> >> > >
> >> >> >> > >
> >> >> >> > >
> >> >> >> > >
> >> >> >> > > --
> >> >> >> > > 欢迎访问:
> >> >> >> > > http://blog.csdn.net/ccat
> >> >> >> > >
> >> >> >> > > 刘鑫
> >> >> >> > > March.Liu
> >> >> >> > >
> >> >> >> > > _______________________________________________
> >> >> >> > > python-chinese
> >> >> >> > > Post: send python-chinese at lists.python.cn
> >> >> >> > > Subscribe: send subscribe to
> >> >> python-chinese-request at lists.python.cn
> >> >> >> > > Unsubscribe: send unsubscribe to
> >> >> >> > > python-chinese-request at lists.python.cn
> >> >> >> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >> >> > >
> >> >> >> > >
> >> >> >> >
> >> >> >>
> >> >> >> _______________________________________________
> >> >> >> python-chinese
> >> >> >> Post: send python-chinese at lists.python.cn
> >> >> >> Subscribe: send subscribe to
> >> python-chinese-request at lists.python.cn
> >> >> >> Unsubscribe: send unsubscribe to
> >> >> python-chinese-request at lists.python.cn
> >> >> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> >> >>
> >> >> _______________________________________________
> >> >> python-chinese
> >> >> Post: send python-chinese at lists.python.cn
> >> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> >> Unsubscribe: send unsubscribe to
> >> python-chinese-request at lists.python.cn
> >> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >> >>
> >>
> >>
> >>
> >> --
> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> >>
> >> _______________________________________________
> >> python-chinese
> >> Post: send python-chinese at lists.python.cn
> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >>
> >
> >
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号