# python3 hdfs 模块
1. pip 安装hdfs模块
# 获得HDFS 连接
from hdfs import Client
client = Client("http://ip:50070") (ip为你自己的ip或映射)
#等同于 bin/hdfs dfs -ls /
files = client.list("/")
print(files)
#文件上传,但是需要注意 修改hdfs访问权限
client.upload("/suns","suns")
#文件下载
client.download("/suns/suns",'xiaohei')
#删除文件
client.delete("/suns/suns")
client.delete("/suns",True)
#新建文件目录
client.makedirs("hdfs_path")
#文件改名,改路径
client.rename()
```