这半年关注外汇牌价, 随手写了一个抓外汇牌价得小代码,可以用execle画出曲线图,方便一些
- #coding: UTF-8
- from BeautifulSoup import BeautifulSoup
- import re, urllib, sys, os
- def getweb(url):
- f = urllib.urlopen(url)
- data =f.read()
- f.close()
- return data
- url = 'http://www.boc.cn/sourcedb/whpj/'
- content = getweb(url)
- soup = BeautifulSoup(''.join(content))
- table_p