[Tutor] Convert my .bat and .vbs to .py

Rob Andrews rob.andrews at gmail.com
Thu Feb 15 20:29:53 CET 2007


Ahh, yes. Your main trouble seems to be the use of \ instead of / in
'C:\testing_it.txt'

Windows uses \, whereas python uses /. So you can replace 'c:\....'
with your choice of the following:

'c:/....' (replacing \ with /)
r'c:\....' (the 'r' before the string tells python it's a raw string)
'c:\\....' (the first \ telling python to take the second \ at face value)

-Rob A.

On 2/15/07, Mark Bystry <mabystry at verizon.net> wrote:
> Well, immediately I am having problems. Be patient with me.
>
> This what I have...
>
> copy_file.py
> ############################################
>
> import os
> import shutil as sh
>
> sh.copy('C:\testing_it.txt', 'D:\')
> raw_input("Done!")
>
> ############################################


More information about the Tutor mailing list