您的位置:首页 > 运维架构 > 网站架构

python中 代码访问某个网站

2018-02-04 21:57 225 查看
import urllib

def read_text():
quotes = open("/Users/Scarlett/Downloads/movie_quotes/movie_quotes.txt")
contents_of_file = quotes.read()
quotes.close()
check_profanity(contents_of_file)

def check_profanity(text_to_check):
url = "http://www.wdylike.appspot.com/?q=" + text_to_check
# print(url)
connection = urllib.urlopen("http://www.wdylike.appspot.com/?q=" + "shit")
output = connection.read()
print(output)
connection.close()

read_text()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: