Python SyntaxError: nieprawidłowy koniec składni = ''
Studiuję książkę „Head First Python” i mam problem z tym kodem:
data = open('sketch.txt')
for each_line in data:
(role, line_spoken) = each_line.split(':')
print(role, end='')
print(' said: ', end='')
print(line_spoken, end='')
data.close()
Błąd:
File "Aula 3.py", line 12
print(role, end='')
^
SyntaxError: invalid syntax
sketch.txt:
Man: Is this the right room for an argument?
Other Man: I've told you once.
Man: No you haven't!
Other Man: Yes I have.
Man: When?
Other Man: Just now.
Man: No you didn't!
Other Man: Yes I did!
Man: You didn't!
Other Man: I'm telling you, I did!
Man: You did not!
Other Man: Oh I'm sorry, is this a five minute argument, or the full half hour?
Man: Ah! (taking out his wallet and paying) Just the five minutes.
Other Man: Just the five minutes. Thank you.
Other Man: Anyway, I did.
Man: You most certainly did not!
Other Man: Now let's get one thing quite clear: I most definitely told you!
Man: Oh no you didn't!
Other Man: Oh yes I did!
Man: Oh no you didn't!
Other Man: Oh yes I did!
Man: Oh look, this isn't an argument!
(pause)
Other Man: Yes it is!
Man: No it isn't!
Jestem dwa dni próbując dowiedzieć się, dlaczego kod nie działa. Błąd jest zawsze wyświetlany w „end =” „”.