サーバレス練習帳

着眼大局着手小局

2018-05-27から1日間の記事一覧

PandasのNan判定

こんな判定法があるのか。 PythonではNanとNanを比較するとFalseがかえってくるため。 だそうです。 ≪引用元≫ linux.oboe-gaki.com

pythonの文字列フォーマットの比較

これでいけるっぽい。 import re result = "" input_tel1 = "03-1111-2222" input_tel2 = "03-452-22234" def check(tel): if re.match('[0-9]{2}-[0-9]{4}-[0-9]{4}', tel): return "OK" else: return "NG" print("input_tel1{0}".format(check(input_tel1)…