Pregunta

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)
¿Fue útil?

Solución

This part:

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

is using the tuple instead of item.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top