Created
December 23, 2020 13:16
-
-
Save Irene-123/e99eafe6b41dc11928b4b042e3f93a9f to your computer and use it in GitHub Desktop.
ATBS2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/python3 | |
import re | |
file=open('mad.txt') | |
text=file.read() | |
file.close() | |
regex=re.compile(r'(NOUN) | (ADJECTIVE) | (VERB)') | |
for i in regex.findall(text): | |
for j in i: | |
if j!='': | |
reg=re.compile(r'{}'.format(j)) | |
inp=input('Enter the substitute for %s: ' %j) | |
text=reg.sub(inp,text,1) | |
print(text) | |
file=open('mad.txt','w') | |
file.write(text) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment