so the below code is supposed to take the first element in the resulting tuple of x and convert it to a string to be used. However, when executing the last line it tells me it can't convert from tuple to 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)
有帮助吗?

解决方案

This part:

root.wgetdir + "\\" + root.website.get() + "\\" + x
                                       right here ^

is using the tuple instead of item.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top