import re
def vowels_digits(filename):
with open(filename) as file:
txt = file.read()
with open('DIGIT.TXT', 'w') as file:
file.write(re.sub(r'\D+', '', txt))
with open('LOWER.TXT', 'w') as file:
file.write(re.sub(r'[^aeiouy]+', '', txt))
with open('UPPER.TXT', 'w') as file:
file.write(re.sub(r'[^AEIOUY]+', '', txt))
vowels_digits('Test.txt')
Comments
Leave a comment