Created
July 27, 2020 21:35
-
-
Save shashankm28/3559f797fad03b3e4c9dc0e773068ff7 to your computer and use it in GitHub Desktop.
Create CSV file using iterator object | Azure Container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_csv(blob_list): | |
try: | |
header = ["blob_name"] # csv file header row (first row) | |
file_name = "blob_list_output.csv" # csv filename | |
with open(file_name, 'w', newline='', encoding="utf-8") as csv_file: | |
writer = csv.writer(csv_file) | |
writer.writerow(header) # write header | |
for blob in blob_list: | |
writer.writerow([blob]) | |
print ('Created CSV.') | |
except Exception as ex: | |
print ('create_csv | Error: ', ex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment