Python无法将元组转换为字符串

2024-09-29 19:27:10 发布

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

因此,下面的代码应该获取x的结果元组中的第一个元素,并将其转换为要使用的字符串。但是,当执行最后一行时,它告诉我它不能从元组转换为str

for x in filelink:
            print(x[0])
            item = str(x[0])
            oldpath = root.wgetdir + "\\" + root.website.get() + "\\" + item
            print(oldpath)
            if os.path.exists(oldpath): shutil.copy(root.wgetdir + "\\" + root.website.get() + "\\" + x, keyworddir + "\\" + item)

Tags: 字符串代码in元素forgetrootwebsite

热门问题