2006年09月14日 星期四 11:01
ÀýÈ磺
subprocess.call('ipconfig -all > D:\\result.txt' shell = True)
Òâ˼ÊǰÑÊä³ö½á¹û´æ·Åµ½result.txtÖУ¬
ÏÖÔÚµÄÎÊÌâÊÇ£¬ÔõôÄܹ»Ê¹Êä³ö½á¹û´æ·Åµ½Ò»¸ö×Ö·ûbuffer»º³åÇøÖÐ
ÓùܵÀpopen? ¿ÉÊÇÔõôÓ𢣿
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20060914/4afcdcd5/attachment.html
2006年09月14日 星期四 13:20
²æé®²È¦¦í¢Ìa²]êöÓN´÷^5×MxÖÜ)Þ±êr¶'r§zǬ¹ºk¡Ç¬±Æ¥*\¢wâ©e·¬º[mÆÛ!zY
2006年09月14日 星期四 13:25
xhsoldier wrote:
>
>
> 例如:
> subprocess.call('ipconfig -all > D:\\result.txt' shell = True)
> 意思是把输出结果存放到result.txt中,
>
> 现在的问题是,怎么能够使输出结果存放到一个字符buffer缓冲区中
>
> 用管道popen? 可是怎么用阿?
>
>
>
>
>
>
>
>
> 买 这 些 让 女 友 很 兴 奋 ( 图 )
> 真 会 过 日 子 ! 一个 月 收 入 5800 漂 亮 MM 的 感 性 生 活 ( 组 图 )
> <http://adtaobao.allyes.com/main/adfclick?db=adtaobao&bid;=600,597,58&cid;=29985,198,1&sid;=32501&show;=ignore&url;=http://www.taobao.com/vertical/lady/pro.php>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
from os import popen
outbuf = popen('ifconfig -all')
s = outbuf.read()
print s
2006年09月14日 星期四 13:31
N§Ë.nèqë,ÍêèÛM:ÓÝx×}¹çJr¶'r§zÇ¥Ël§+a¢w'Eêr¶'r§zǬ¹ºk¡Ç¬±Æ¥*\¢wâ©e·¬º[mÆÛ!zY
2006年09月14日 星期四 13:31
N§Ë.nèqë,ÍêèÛM:ÓÝx×}¹çJr¶'r§zÇ¥Ël§+a¢w'Eêr¶'r§zǬ¹ºk¡Ç¬±Æ¥*\¢wâ©e·¬º[mÆÛ!zY
Zeuux © 2025
京ICP备05028076号