KOTA ITO

Generation

generate functionFri, 16 Dec 2022

タグで囲まれた文字列から文字列のみを取得する。

def get_text(file_name): with open(file_name, 'r', encoding='utf-8') as file: soup = BeautifulSoup(file.read(), 'lxml') return soup.text

Questions about programming?Chat with your personal AI assistant