import os
os.chdir('d:/Python_test')
try:
with open('sketch.txt') as data:
for each_line in data:
try:
(role, line_spoken) = each_line.split(':')
print(role, end='')
print(' said: ', end='')
print(line_spoken, end='')
except ValueError as err:
#print('there is no ";" in the sentence! ' + str(err))
pass
except:
print('The datafile is missing!')