Python 读取HDFS 数据
# -*- coding:utf-8 -*- from hdfs.client import Client client = Client("http://localhost:50070") filepath="/data/input/test.txt" with client.read(filepath) as fs: content = fs.read() print(content)
提示:mac pycharm python2.7环境,亲测无误!
# -*- coding:utf-8 -*- from hdfs.client import Client client = Client("http://localhost:50070") filepath="/data/input/test.txt" with client.read(filepath) as fs: content = fs.read() print(content)
提示:mac pycharm python2.7环境,亲测无误!