Python Web Scraping Cookbook
上QQ阅读APP看书,第一时间看更新

Determining the file extension from a content type

It is good practice to use the content-type header to determine the type of content, and to determine the extension to use for storing the content as a file.