编程语言
首页 > 编程语言> > python连接Hadoop命令

python连接Hadoop命令

作者:互联网

from hdfs import *

client = Client("http://192.168.248.10:9870", root="/", timeout=100)
#文件夹的操作
'''
print(client.list("/data/class2"))
client.makedirs("/data/class3")
print(client.list("/data"))
client.delete("/data/class1")
print(client.list("/data"))
client.rename("/data/class3", "/data/class33")
print(client.list("/data"))
'''
#文件的操作:上传  下载   读文件  改名、删除
#client.upload("/data/", "D:/hosts")
print(client.list("/data"))
#client.download("/data/class2/水浒传.txt", "D:/")
print(client.read("/data/hosts").read())

标签:python,class2,list,Hadoop,read,client,print,data,连接
来源: https://blog.csdn.net/qq_65610501/article/details/122355597