2018-05-27から1日間の記事一覧
こんな判定法があるのか。 PythonではNanとNanを比較するとFalseがかえってくるため。 だそうです。 ≪引用元≫ linux.oboe-gaki.com
これでいけるっぽい。 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)…