get filename and extension of files in hdfs with Python

Is there an equivalent of the os module in Python do read the filesystem (hadoop 2.6)?

In particular I am interested about getting extension of a file and base name (not including the full path).


No need for "an equivalent", os.path.basename is exactly the same for hdfs.


import os.path as path
print path.basename("/path/to/file.txt")
# file.txt

os.path — Common pathname manipulations

Need Your Help

Tools For Code Performance in .Net And C#

c# performance

For Example You know foreach loop is heavy And if we use for loop is Better.