KOTA ITO

Generation

generate functionFri, 16 Dec 2022

長い文字列の中から、「調査対象期間:」と「〜」に囲まれた日付の文字列だけを取得する

def get_date(text): start = text.find("調査対象期間:") + 6 end = text.find("〜", start) return text[start:end] get_date("今日は調査対象期間:2018年1月〜2018年2月まで")

Questions about programming?Chat with your personal AI assistant