简体   繁体   中英

How can I access a .txt file which is present in Azure datalake gen2 directly without downloading

How can I access a .txt file which is present in Azure datalake gen2 directly without downloading. I was able to download and read it but is there any way to directly read file from gen2 directly.

I used read_file method DataLakeFileClient() but this method ouputs entire data, is there any way to read the file line by line?

You can use urllib:

import urllib.request

file = urllib.request.urlopen('your-txt-file-url')
for line in file:
     print(line.decode().strip())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM