无法创建一个新的 .jpg文件 复制另一个图片的内容
file1=open('C:\Users\86187\Pictures\Saved Pictures\微信图片_20220612163405.jpg','rb')
#以前就有的一个图片的位置,进行读操作
file2=open('D:/陈朋/a.jpg','wb')
创建一个新的文件,进行写操作
file2.write(file1.read())
报错内容是:
File "D:\软件\pycharm\pythonProject\文件.py", line 36
file1=open('C:\Users\86187\Pictures\Saved Pictures\微信图片_20220612163405.jpg','rb')
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
file1=open('C:\Users\86187\Pictures\Saved Pictures\微信图片_20220612163405.jpg','rb')
->
file1=open(r'C:\Users\86187\Pictures\Saved Pictures\微信图片_20220612163405.jpg','rb')
你得是哪个版本呀
不知道你这个问题是否已经解决, 如果还没有解决的话: