开发者

Urllib trouble across platforms

开发者 https://www.devze.com 2023-02-06 21:38 出处:网络
On Linux, urllib.urlopen(\"https://www.facebook.com/fql.php?query=SELECT first_name FROM user\") will have the spaces automatically quoted and run smoothly.

On Linux, urllib.urlopen("https://www.facebook.com/fql.php?query=SELECT first_name FROM user") will have the spaces automatically quoted and run smoothly.

(By the way, the URL is fictional)

However on mac, this is not the case. Somehow the URL is not escaped, and an error would be thrown. I have checked both python versions to be at least 2.6 and the versio开发者_StackOverflown of urllib to be 1.17

Is this a bug?


urlopen documentation doesn't promise you to escape anything. Use urllib.quote() to escape it yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号