from re import match
input = ['a/b', 'g', 'c/d', 'h', 'e/f', '/', 'a/']
[m.groups()[0] for m in (match('.*/([\\w+]$)', item) for item in input) if m]
How to create a list from another list using specific criteria in Python?