This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
page = urllib.request.urlopen("http://beans-r-us.appspot.com/prices.html") | |
text = page.read().decode("utf8") | |
print(text) | |
price = text[234:238]; | |
print(price) | |
where = text.find('>$') | |
start_of_price = where + 2 | |
end_of_price = start_of_price + 4 | |
price = text[start_of_price : end_of_price] | |
print(price + " by using find command") |
type each command
import urllib.request
x = urllib.request.urlopen("http://www.google.com/")
print(x.read())
https://www.youtube.com/watch?v=5GzVNi0oTxQ
2.type line by line as below code
from urllib.request import urlopen
html = urlopen("http://www.google.com/")
print(html)
print(html.read())
http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python
reference:
[book] A Brain-Friendly Guide, Paul Barry && David Griffths
reference:
[book] A Brain-Friendly Guide, Paul Barry && David Griffths
0 意見:
張貼留言