Python Forum
FileNotFound when copy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileNotFound when copy
#4
Not to address the problem but suggestion to improve code:

if f.endswith(".pdf") or f.endswith(".docx") or f.endswith(".doc"):
str.endswith() accepts tuple as argument:

Quote:Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for.

so one can use:

if f.endswith(('.pdf', '.docx', '.doc'))
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
FileNotFound when copy - by linh_py - Jul-05-2019, 03:51 AM
RE: FileNotFound when copy - by Gribouillis - Jul-05-2019, 05:19 AM
RE: FileNotFound when copy - by linh_py - Jul-05-2019, 05:33 AM
RE: FileNotFound when copy - by perfringo - Jul-05-2019, 07:00 AM

Forum Jump:

User Panel Messages

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