菜鳥Python(4)

851 ワード

申し訳ございませんが、このブログはサードパーティのWebサイトの検証が必要なため、しばらく利用できません.
敬語を使わない
#          
def read_text():
    #    open         
    quotes = open("E:\ButterKnife.txt")
    #     
    contents_of_file=quotes.read()
    print(contents_of_file)
    quotes.close()
read_text()

組み込み関数
Ptyhonの内蔵関数
コードによるWebサイトへのアクセス
不敬语検索サイトは科学的にインターネットを利用する必要があるかもしれませんが、このサイトの接尾辞を利用して、非文明的な字があるかどうかを検索します.
import urllib
def read_text():
    quotes = open("E:\ButterKnife.txt")
    contents_of_file=quotes.read()
    print(contents_of_file)
    quotes.close()
    check_profanity(contents_of_file)
def check_profanity(check_text):
    connection=urllib.urlopen("http://www.wdylike.appspot.com/?q="+check_text)
    output=connection.read()
    print(output)
    connection.close()
read_text()