2005年06月08日 星期三 11:58
陈锦 wrote:
> 各位好!
>
> 使用
>
>>>>import urllib
>>>>params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>>>f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
>>>>print f.read()
>
>
> 但是显示出来的页面图片显示不出来, 没有重定向.
你是windows平台吧,呵呵,可恶的微软默认标准输出是text mode的,会把\n变成
\r\n。
先用msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)设定标准输出为bin mode。
--
Qiangning Hong
___________________________________________________________
/ Never try to teach a pig to sing. It wastes your time and \
| annoys the pig. |
| |
\ -- Lazarus Long, "Time Enough for Love" /
-----------------------------------------------------------
\
\
,__, | |
(oo)\| |___
(__)\| | )\_
| |_w | \
| | || *
Cower....
Zeuux © 2025
京ICP备05028076号