from shutil import copy f = open(r'C:\temp.txt', 'r') for i in f.readlines(): print i copy(i,r"C:\opencascade") f.close()
I am reading path from temp.txt file which has 500 lines each line is a path for specific file to be copied to location "C:\opencascade" How to convert 'i' in above code to be raw string to make the code work
Error from interpreter
copy(i,r"C:\opencascade")
File "C:\Python26\lib\shutil.py", line 88, in copy
copyfile(src, dst)
File "C:\Python26\lib\shutil.py", line 52, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\\OPENCASCADE6.2.0\\ROS\\INC\\toptools_hsequenceofshape.hxx\n'