代码为:
import re
def xiny(x, y):
return bool(re.findall(x, y))
i = 1
while i <= 100:
if i % 7 == 0 or xiny("7", str(i)) == True:
print("过", end=",")
else:
print(i, end=",")
i = i + 1
输出结果:
1,2,3,4,5,6,过,8,9,10,11,12,13,过,15,16,过,18,19,20,过,22,23,24,25,26,过,过,29,30,31,32,33,34,过,36,过,38,39,40,41,过,43,44,45,46,过,48,过,50,51,52,53,54,55,过,过,58,59,60,61,62,过,64,65,66,过,68,69,过,过,过,过,过,过,过,过,过,过,80,81,82,83,过,85,86,过,88,89,90,过,92,93,94,95,96,过,过,99,100,