Discuss / Python / 问题2

问题2

Topic source

老施基

#1 Created at ... [Delete] [Delete and Lock User]

import os

s = 'afci'

name = []

for x in os.listdir('.'):

    if os.path.isfile(x):

    name = os.path.split(x)[1];

    i = 0

    j = 0

    n = 0

    while True:

    if name[i] == s[j]:

    j += 1

    i += 1

    if j == 4:

    print(x)

    break

    elif i >= len(name):

    break


  • 1

Reply