The problem is with a file_path variable between triple quotes. C:\ starts an eight-character Unicode escape. In the code, the escape is followed by the character U, which is invalid.
Double up your backslashes to escape them, e.g.:
"""
file_path = (r'C:\\Users\\Luka\\Desktop\\Pyhton exercises\\pi_digits.txt')
with open(file_path) as file_object: contents = file_object.read() print(contents) #print(contents.rstrip()) # rstrip should remove blank space at the end
"""
filename = "prova.txt"
Do check out Data Science with Python course which helps you understand from scratch