data = open('sketch.txt')
for each_line in data:
try:
(role, line_spoken) = each_line.split(':', 1)
print(role, end='')
print(' said: ', end='')
print(line_spoken, end='')
except:
pass
data.close()
I'M gettin the following error when I run this code but it looks exactly like what I'M seeing in my Head First book.
File "sketch.py", line 6
print(role, end='')
^
SyntaxError: invalid syntax
------------------
(program exited with code: 1)
Press return to continue