---
title: "简洁的python，简洁的urllib"
author: "fyting"
date: "2007-08-08T00:31:24Z"
tags: ["F#", "Python"]
slug: "python-urllib"
draft: false
lastmod: "2007-08-08T00:31:24Z"
id: 109886
url: "https://fyting.iteye.com/blog/109886"
---

```

实现图片下载
import urllib
url = r"http://www.iteye.com/images/logo.gif"
path = r"h:\downloads\1.jpg"
data = urllib.urlopen(url).read()
f = file(path,"wb")
f.write(data)
f.close()

```

当然还有更简洁的

```

import urllib
url = r"http://www.iteye.com/images/logo.gif"
path = r"h:\downloads\1.jpg"
data = urllib.urlretrieve(url,path)

```