直接從使用content=urllib.urlopen(url).read() 返回的內容是ASCII碼。url
若是從ASCII碼中使用find() 方法會拋出異常。spa
這時候須要在代碼裏面貼一下以下的代碼code
import sys reload(sys) sys.setdefaultencoding( "utf-8" )
而後就能夠愉快使用find了。blog