
看不懂,能讲讲思路吗,或者有没有更简单的方法呢
感谢
(字数不够水一水123456789)
a = list(range(1,10))
su = 2
while su <= 9:
m = len(a)
for j in range(m):#当相同的位数循环完了再执行su加1,进行下一位数循环
for i in [1,2,3,4,5,6,7,8,9]:
n = a[0] * 10 + i
if not n % su and (len(set(str(n))) == su):#过滤重复的数字
a.append(n)
a.remove(a[0])
su += 1
print(a)