小编pet*_*ete的帖子

Python:列表和字符串匹配

我有以下内容:

temp = "aaaab123xyz@+"

lists = ["abc", "123.35", "xyz", "AND+"]

for list in lists
  if re.match(list, temp, re.I):
    print "The %s is within %s." % (list,temp)
Run Code Online (Sandbox Code Playgroud)

re.match只匹配字符串的开头,如何在中间匹配子字符串.

python match

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

match ×1

python ×1