2004年05月23日 星期日 11:44
我有一个笔记 ----- Original Message ----- From: rocky To: python-chinese at lists.python.cn Sent: Sunday, May 23, 2004 10:32 AM Subject: [python-chinese] 大家好~,我是新手,不知道到哪里有中文Python文档看 最好是CHM格式的手册 ------------------------------------------------------------------------------ _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040523/e82116ba/attachment.htm
2004年05月23日 星期日 13:45
miao wen,您好!
你说的命令行的方式是指在设备上获取输入信息是吧,在windows和unix下是不一样的。
unix下的做法是用sys模块中的sys.stdin来获取,但是这个方法不能在windows下使用。
======= 2004-05-22 11:26:51 您在来信中写道:=======
>我现在再RH9下用python 2.2.X 编写script 程序 交互一个检索系统。
>改系统可以以一个命令行形式启动,利用 命令行,在shell里交互检索。
>
>别的同门有用perl 写的,都大同小异。
>我用sin,sout = os.popen2('com')
>来创建子线程,调用那个系统('com'是那个系统的启动命令)之后用file sin, sout
>“虚拟“子线程的stdin and stdout.
>一个非常郁闷的问题是,我好像无法进行交互操作。
>根据这个对象的api,我找到的,只有当sin
>关闭后,我才能从sout读出子线程的输出结果。
>我的天啊,但是有的时候我需要,读出子线程的输出,然后再作为参数输回系统,完成检索。可是一旦我关闭了sin,就没法再进行输入操作了。
>那么我似乎只能进行“一个来回”-“输入-关闭输入-读出输出”
>不知道再其他的script
>程序里面是不是也是这样?比如perl,如果是,那么他们是怎么搞定类似的交互性操作的?
>因为再进行一个查询的时候不能中断系统(子线程)否则,检索结果会有不同。
>或者我干脆就用错了,应该用os.exec 什么的?
>谢谢大家帮忙
>
>_________________________________________________________________
>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
>http://join.msn.com/?page=features/virus
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
>
= = = = = = = = = = = = = = = = = = = =
致
礼!
info
info at xichen.com
2004-05-23
Zeuux © 2025
京ICP备05028076号