Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- files = os.listdir('test_source')
- for f in files:
- pf = os.path.join('test_source', f)
- print pf, os.path.exists(pf)
- test_sourceex True
- test_sourcejoe True
- test_sourcemie.txt True
- test_source__()'''.txt True
- test_source????.txt False
- files = os.listdir(u'test_source')
- for f in files:
- pf = os.path.join(u'test_source', f)
- print pf.encode('ascii', 'replace'), os.path.exists(pf)
- test_sourceex True
- test_sourcejoe True
- test_sourcemie.txt True
- test_source__()'''.txt True
- test_source????.txt True
- subdir/bar.txt True
- subdir/foo.txt True
- subdir/עִבְרִית.txt True
- for f in os.listdir(u'subdir'):
- pf = os.path.join(u'subdir', f)
- print pf, os.path.exists(pf)
- subdir/bar.txt True
- subdir/foo.txt True
- subdir/עִבְרִית.txt True
- >>>os.listdir(u'listdir')[2]
- u'u05e2u05b4u05d1u05b0u05e8u05b4u05d9u05ea.txt'
Add Comment
Please, Sign In to add comment