pip install hdfs

python 读取hdfs目录或文件

import hdfs  client =hdfs.Client("http://10.10.1.4:50070") fileDir="/user/hive/warehouse/house.db/dm_house/dt=201800909" try:     status=client.status(fileDir,False)     if status:         print (status)         rst=client.download(fileDir,"/home/dev/gewei")         print (rst) exception Exception as e:     print (e)