Code:
>>> os.chdir('/tmp')
>>> import pprint
>>> pprint.pprint([file for file in os.walk(os.curdir)])
[('.',
['.com.google.Chrome.ccfBLb',
'systemd-private-af43573ce38f41d288f35735f44019d6-systemd-resolved.service-3mRoER',
'.XIM-unix',
'systemd-private-af43573ce38f41d288f35735f44019d6-apache2.service-0mKaXr',
'.X11-unix',
'.Test-unix',
'.ICE-unix',
'systemd-private-af43573ce38f41d288f35735f44019d6-fwupd.service-Xh9wyA',
'docview1000',
'launchpadlib.cache.wl63h22s',
'.font-unix',
'mozilla_lambertdw0',
'hsperfdata_lambertdw',
'thunderbird_lambertdw',
'ssh-b6BLCRmIrbZn',
'systemd-private-af43573ce38f41d288f35735f44019d6-rtkit-daemon.service-QUMCl1',
'systemd-private-af43573ce38f41d288f35735f44019d6-colord.service-3lVy4V',
'systemd-private-af43573ce38f41d288f35735f44019d6-systemd-timesyncd.service-8wO1xR'],
['geIconCacheLock',
'Makefile',
'unity_support_test.0',
'GeckoChildCrash30155.extra',
'config-err-ZA1PRp',
'geColladaModelCacheLock',
'p.py']),
('./.com.google.Chrome.ccfBLb', [], ['SingletonSocket', 'SingletonCookie']),
('./.XIM-unix', [], []),
('./.X11-unix', [], ['X1', 'X0']),
('./.Test-unix', [], []),
('./.ICE-unix', [], ['1611', '2225']),
('./docview1000',
['2017 Ministry Plan - 20170511 '
'revisions.docx-0606cf14fd83a1dc0e3469b8ea1d1220'],
[]),
('./docview1000/2017 Ministry Plan - 20170511 '
'revisions.docx-0606cf14fd83a1dc0e3469b8ea1d1220',
[],
['resolution.el', 'doc.pdf', 'page-2.png', 'page-1.png']),
('./launchpadlib.cache.wl63h22s', [], []),
('./.font-unix', [], []),
('./mozilla_lambertdw0', [], []),
('./hsperfdata_lambertdw', [], []),
('./thunderbird_lambertdw', [], ['.parentlock']),
('./ssh-b6BLCRmIrbZn', [], ['agent.2007'])]
>>>
So you've got two problems. Using os.walk directly is incorrect. And when it returns a string, the filter function is trying to match one character at a time.