Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python covert vtt subtittle to text txt file

import re
bad_words = ['-->','</c>'] 


with open('example.en.vtt') as oldfile, open('newfile.txt', 'w') as newfile:
    for line in oldfile:
        if not any(bad_word in line for bad_word in bad_words):
            newfile.write(line)


with open('newfile.txt') as result:
    uniqlines = set(result.readlines())
    with open('sub_out.txt', 'w') as rmdup:
        mylst = map(lambda each: each.strip(">>"), uniqlines)
        print(mylst)
        rmdup.writelines(set(mylst))
Comment

PREVIOUS NEXT
Code Example
Python :: read past tense 
Python :: player to walk on the surface 
Python :: instead of: firstName = "John" lastName = "Henry" city = "Manchester" 
Python :: python getpass save file 
Python :: sympy.diff 
Python :: re.split return none in the list 
Python :: python plot draw the goal line 
Python :: pip is not recognized as an internal or external command 
Python :: seleniu get element value and store it in a variable - selenium remember user 
Python :: tkinter file dialog multiple file types 
Python :: x not defined python 
Python :: Wireframes and Surface Plots 
Python :: django amzon like app 
Python :: python notification image 
Python :: upperWhite = np.array([109, 255, 255]) 
Python :: count numbers that add up to 10 in python 
Python :: gizeh python 
Python :: explore data dataframe pandas 
Python :: python django 
Python :: sending whatsapp message from python notebook 
Python :: exterat pdf python 
Python :: build the .pyx file to c and run on python 
Python :: _set.filter django 
Python :: python if block 
Python :: split dataset folders in train test valid using python 
Python :: Python Tkinter Label Widget Syntax 
Python :: python equivalent linkedhashmap 
Python :: how to get the string between brackets in a string in python 
Python :: check true false in python 
Python :: Get Result From Table Django 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =