Merging txt files whose last letters repeat in python : <p>I have a folder that includes txt files. Txt files' names always end up with those years '_1980', '_1981' '_1982' ... '_2015', but their names start with different numbers. I want to merge txt files whose file names start with same letters/numbers but finish with those numbers above.
As an example for the txt files,
<a href="https://i.stack.imgur.com/P335f.jpg" rel="nofollow noreferrer">example</a></p>

<p>Eventually, merged file are abc_allyears.txt and xyz_allyears.txt and so on 'otherletters'_allyears.txt</p>

<p>Can you write related python code?
Thank you.</p>
