python3判断字符串内是否含有字母,并打印字母出来 # !/usr/bin/python3.4 # -*- coding: utf-8 -*- import re a = "8a2656" b = "1514561A1321" c = "15465461654" d = "afgwgw" r = re.compile(r'^[a-zA-Z]') for item in d: result = r.match(item) i
string.gsub 函数有三个参数:目标串,模式串,替换串.基本作用是用来查找匹配模式的串,并将使用替换串其替换掉: s = string.gsub("Lua is good", "good", "bad?") print(s) --> Lua is bad string.gsub 的第二个返回值表示进行替换操作的次数.例如,下面代码计字符串中空格出现的次数: _, count = string.gsub("test te