Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shuntil.copyfile help
#1
So when I run this, I get "TypeError: bad operand type for unary +: 'str'"

import os
import shutil

src = os.path.expanduser('~/Downloads')
print(src)
os.getcwd()
dst = os.getcwd
print(dst)

for root, dirs, files in os.walk(src):
    for file in files:
        if file.endswith(('.txt', '.md')):
        print(os.path.join(root,file))
        shutil.copyfile(dst, +file)
Reply


Messages In This Thread
Shuntil.copyfile help - by mcesmcsc - Dec-20-2019, 05:14 PM
RE: Shuntil.copyfile help - by micseydel - Dec-20-2019, 05:39 PM
RE: Shuntil.copyfile help - by mcesmcsc - Dec-20-2019, 05:43 PM
RE: Shuntil.copyfile help - by micseydel - Dec-20-2019, 05:49 PM
RE: Shuntil.copyfile help - by mcesmcsc - Dec-20-2019, 05:57 PM
RE: Shuntil.copyfile help - by snippsat - Dec-20-2019, 06:47 PM
RE: Shuntil.copyfile help - by mcesmcsc - Dec-20-2019, 07:57 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020