我正在尝试从网络上的 python 模块中读取一些数据。
我设法阅读,但是在解析这些数据和获取所需信息时遇到了一些困难。
我的代码如下。任何帮助表示赞赏。
#!/usr/bin/python2.7 -tt
import urllib
import urllib2
def Connect2Web():
aResp = urllib2.urlopen("https://uniservices1.uobgroup.com/secure/online_rates/gold_and_silver_prices.jsp");
web_pg = aResp.read();
print web_pg
#Define a main() function that prints a litte greeting
def main():
Connect2Web()
# This is the standard boilerplate that calls the maun function.
if __name__ == '__main__':
main()
当我打印此网页时,我会打印整个网页。
我想从中提取一些信息(例如"SILVER PASSBOOK ACCOUNT"
并从中获取费率),我在解析这个 html 文档时遇到了一些困难。