在布尔值=true时运行循环

2024-05-15 01:04:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我真的找不到这个小问题的解决方案,我只想在PASS=True时启动循环。 当我运行程序时,它会创建目录,但不会出错

if check_dir == False:
    #creates the directory
    os.mkdir(dir_path)
Createdfilescounter = 0
lenght_files = len(files) - 1
kamel = False
for file in files:
    if Createdfilescounter == lenght_files:
        kamel = True
    with open(dir_path + extend + file, "w") as f:
        f.write("File saved")

while kamel:
    def takess():
        im = ImageGrab.grab()
        im.save(dir_path+ "/" + "screenshot.png")

Tags: path程序目录falsetrueifdirpass

热门问题