【发布时间】:2018-06-03 06:36:09
【问题描述】:
确保以下内容可信的最快方法是什么:
email = "foobar@gmail.com"
trusted = [".co.uk", ".com", ".net", ".edu", ".ac.uk"]
【问题讨论】:
-
可信的,解释清楚
-
你的意思是
if any(email.endswith(s) for s in trusted)吗? -
字符串中的endswith()方法
标签: python