I don't know why there is a Unicode error if I don't delete the annotation when I made a comment with ''.

Asked 1 years ago, Updated 1 years ago, 224 views

'''

f = open(r"C:\Users\ocwot\Desktop\파이썬 연습\example.txt",'a+' ,encoding='utf-8')

f.write('Deae,') #Add Data

f.seek(0)

print(f.read())

f.close()

'''

f = open(r"C:\Users\ocwot\Desktop\파이썬 연습\example.txt", encoding='utf-8')

print(f.read())

The txt file contains: Deae,Deae,Deae,Deae,DeaeDeae, There's an article like this.

I understand that the code in '' is annotated and does not affect it. If you erase the content of the annotation, it's not a mistake. 지우지 않으면 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 14-15: truncated \UXXXXXXXX escape PSC:\Users\ocwot\Desktop\Python Practice> This error occurs. I don't know why.

python

2023-03-18 10:29

1 Answers

"""
Annotation
"""


2023-03-19 01:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.