Skip to content

Instantly share code, notes, and snippets.

@shashankm28
Created July 27, 2020 21:35
Show Gist options
  • Save shashankm28/3559f797fad03b3e4c9dc0e773068ff7 to your computer and use it in GitHub Desktop.
Save shashankm28/3559f797fad03b3e4c9dc0e773068ff7 to your computer and use it in GitHub Desktop.
Create CSV file using iterator object | Azure Container
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