Question

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)
Was it helpful?

Solution

This part:

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

is using the tuple instead of item.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top