<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Townes &#187; url编码函数</title>
	<atom:link href="https://thetownes.coolpage.biz/?feed=rss2&#038;tag=url%E7%BC%96%E7%A0%81%E5%87%BD%E6%95%B0" rel="self" type="application/rss+xml" />
	<link>https://thetownes.coolpage.biz</link>
	<description>本站已转移至：http://www.thetownes.info</description>
	<lastBuildDate>Thu, 01 Aug 2013 11:49:56 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>Python的url编码函数使用的一个小问题</title>
		<link>https://thetownes.coolpage.biz/?p=473</link>
		<comments>https://thetownes.coolpage.biz/?p=473#comments</comments>
		<pubDate>Thu, 01 Aug 2013 03:43:21 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[url编码函数]]></category>

		<guid isPermaLink="false">http://thetownes.coolpage.biz/?p=473</guid>
		<description><![CDATA[python的url编码函数是在类urllib库中，使用方法是： 编码：urll &#8230; <a href="https://thetownes.coolpage.biz/?p=473">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>python的url编码函数是在类urllib库中，使用方法是：</p>
<p>编码：urllib.quote(string[, safe])，除了三个符号“_.-”外，将所有符号编码，后面的参数safe是不编码的字符，使用的时候如果不设置的话，会将斜杠，冒号，等号，问号都给编码了。<br />
如下：</p>
<p>&gt;&gt;&gt; import urllib &gt;&gt;&gt; print urllib.quote(&#8220;<a href="http://neeao.com/index.php?id=1">http://neeao.com/index.php?id=1</a>&#8220;) http%3A//neeao.com/index.php%3Fid%3D1 这样在使用urllib.urlopen打开编码后的网址的时候，就会报错了。</p>
<p>设置下不编码的符号：</p>
<p>&gt;&gt;&gt; print urllib.quote(&#8220;<a href="http://neeao.com/index.php?id=1%22,%22:?=/">http://neeao.com/index.php?id=1&#8243;,&#8221;:?=/</a>&#8220;)<a href="http://neeao.com/index.php?id=1">http://neeao.com/index.php?id=1</a>&nbsp;这下就好了。</p>
]]></content:encoded>
			<wfw:commentRss>https://thetownes.coolpage.biz/?feed=rss2&#038;p=473</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
