Python/Discord当我试图创建一个文件夹时,它位于我的桌面上,而不是指定的文件夹中

2024-06-25 23:00:44 发布

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

这是当前代码:

   if message.content == "MMO start":
        dir=(r"C:\\Users\\User\Desktop\MMMOProfiles")
        file = str(message.author)
        path = os.path.join(dir,file)
        isExist = os.path.exists(path)
        if isExist == True:
            await message.channel.send("You already have a profile")
        elif isExist == False:
            await message.channel.send("Creating profile")
            file2 = str(message.author)
            dir =(r"C:\\Users\\User\Desktop\MMOProfiles")
            os.mkdir(file2)

当我试图让它创建文件夹,虽然它在桌面上,而不是在桌面上的文件夹


Tags: pathsendmessageifosdirchannelawait