[英]SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape , on an image
I would like to add an image, in order to execute a Fourier transform on the image.我想添加一个图像,以便对图像执行傅立叶变换。 Here is my code that has the syntax fault at imageio.imread
这是我的代码,在 imageio.imread 有语法错误
img1 = imageio.imread("C:\\Users\\Arnold Bailie.spyder-py3\\spyder.lock\\einstein.jpg") img1 = imageio.imread("C:\\Users\\Arnold Bailie.spyder-py3\\spyder.lock\\einstein.jpg")
Here, \\U
in "C:\\Users\\Arnold Bailie.spyder-py3\\spyder.lock\\einstein.jpg"
starts an eight-character Unicode escape, such as \\U00014321
.此处,
"C:\\Users\\Arnold Bailie.spyder-py3\\spyder.lock\\einstein.jpg"
\\U
开始一个八字符的 Unicode 转义,例如\\U00014321
。 In your code, the escape is followed by the character "s"
which is invalid.在您的代码中,转义符后跟无效的字符
"s"
。
So, you have 3 possibilites所以,你有 3 种可能性
img1 = imageio.imread(r"C:\Users\Arnold Bailie.spyder-py3\spyder.lock\einstein.jpg")
img1 = imageio.imread("C:\\Users\\Arnold Bailie.spyder-py3\\spyder.lock\\einstein.jpg")
img1 = imageio.imread("C:/Users/Arnold Bailie.spyder-py3/spyder.lock/einstein.jpg")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.