I have a file that contains a bunch of filenames, i.e.:
hello.txt
goodbye.py
test..pdf
n3w.world.file.text
...
I am trying to ignore all filenames with multiple dots. Currently I am able to find all the filenames using:
import re
data = ['hello.txt', 'goodbye.py', 'test..pdf', 'n3w.world.file.text']
matches = re.findall('([\w].+)\.(\w+)', data)
print(matches)
However this prints out all the filenames. How can I modify this to just print out: hello.txt
and goodbye.py
?