在MacBook Pro上使用Python 3.6.4。 添加要附加到网址地址栏的文字文件是否有更顺畅的方式?
请原谅我的无知,我是Python的新手。这是我最好的一击......
import urllib
import urllib.request
import urllib.parse
text = "Global ambitions with regional insight is a common mantra among local firms but not many have the financial backing and pedigree of this leading financial institution. While many brokerages have shut their doors or downsized, this trading firm has continued to grow and there are no plans to slow down now. Already with a portfolio of substantial institutional and private clients, it is important to offer a diverse range of products to meet demand.
Skills."
site_url = "http://www.wdylike.appspot.com/?"
file_contents_in_url = urllib.parse.urlencode({'q' : text})
check = site_url + file_contents_in_url
#print(check)
url = urllib.request.urlopen(check)
url_bytes = url.read()
#print(url_bytes)
site_url_contents = url_bytes.decode("utf8")
#print(site_url_contents)