Linked Questions

Popular Questions

Sorry I am very new to python and trying to figure out how to take out a specific string sequence out of all the string

I tried using re but I don't quite get it..

import re

userinput = input('Enter the name of the file:')
file = open(userinput)
info = file.readlines()
info = re.sub(r'\[[.+]\]','',info)
print(info)
file.close()

if file includes: notokay[okay]notokayas[okay2]sjnfksdnfnslk

I want to be able to extract: okay, okay2

Related Questions