Try detect encoding chardet of file.
If i save test from your example,it will work as i always save files in utf-8.
If i save test from your example,it will work as i always save files in utf-8.
with open('test.srt', encoding='utf-8f') as f: file_list = [i.strip() for i in f]
Output:>>> file_list
['9',
'00:00:15,377 --> 00:00:18,570',
'ESTAMOS HACIENDO',
'UN FASCINANTE EXPERIMENTO.',
'',
'10',
'00:00:19,150 --> 00:00:20,280',
'AÚN LO ESCUCHO.']
Can also read in with utf-8 and errors='ignore'
or errors='replace'
.with open('test.srt', encoding='utf-8f', errors='replace') as f: file_list = [i.strip() for i in f]
Quote:The lines where I do the replacement are the following:Use string formatting
f-string
,then it look much nicer than all +
.hoursBegin = '12' minutesBegin = '55' print(f'{hoursBegin}:{minutesBegin}')
Output:12:55