Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import shutil
#7
'r' denotes it is a raw string. Because you are using back-slash (\) and back-slash is used as escape char it may cause problems with your path. e.g. if you have \t this will be considered tab.

Unless an 'r' or 'R' prefix is present, escape sequences in string and bytes literals are interpreted according to rules similar to those used by Standard C. The recognized escape sequences are:
Escape Sequence Meaning Notes
\newline Backslash and newline ignored
\\ Backslash (\)
\' Single quote (')
\" Double quote (")
\a ASCII Bell (BEL)
\b ASCII Backspace (BS)
\f ASCII Formfeed (FF)
\n ASCII Linefeed (LF)
\r ASCII Carriage Return (CR)
\t ASCII Horizontal Tab (TAB)
\v ASCII Vertical Tab (VT)
\ooo Character with octal value ooo (1,3)
\xhh Character with hex value hh (2,3)


you can use forward-slash instead
shutil.copy('C:/111/AAA.PDF', 'C:/222/AAA.PDF')
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
import shutil - by beni - Nov-13-2018, 07:16 AM
RE: import shutil - by wavic - Nov-13-2018, 07:49 AM
RE: import shutil - by beni - Nov-13-2018, 08:23 AM
RE: import shutil - by wavic - Nov-13-2018, 08:57 AM
RE: import shutil - by buran - Nov-13-2018, 09:12 AM
RE: import shutil - by beni - Nov-13-2018, 11:45 AM
RE: import shutil - by buran - Nov-13-2018, 11:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  use of shutil.copytree with ENOTDIR exception yan 2 963 Nov-29-2023, 03:02 PM
Last Post: yan
  shutil.move make data corrupt kucingkembar 0 828 Feb-01-2023, 01:30 PM
Last Post: kucingkembar
  Merge htm files with shutil library (TypeError: 'module' object is not callable) Melcu54 5 1,660 Aug-28-2022, 07:11 AM
Last Post: Melcu54
  extra slashes in the network path for shutil.copy tester_V 3 3,822 Jun-02-2021, 07:57 AM
Last Post: supuflounder
  concatenat - shutil jmabrito 3 2,226 Feb-11-2021, 12:17 PM
Last Post: jmabrito
  Shutil FileNotFoundError: Errno 2 Help lord_kaiser 8 10,607 Aug-10-2020, 08:45 AM
Last Post: lord_kaiser
  shutil.copy questions kristianpython 3 2,334 Jul-14-2020, 09:19 AM
Last Post: Gribouillis
  Shutil move if file exists in destination Friend 2 6,835 Feb-02-2020, 01:45 PM
Last Post: Friend
  Shutil attempts to copy directories that don't exist ConsoleGeek 5 4,606 Oct-29-2019, 09:26 PM
Last Post: Gribouillis
  Help copying files with shutil hikerguy62 2 4,348 Aug-02-2019, 08:16 PM
Last Post: hikerguy62

Forum Jump:

User Panel Messages

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