# Saving the data to the CSV file with open(csv_file, 'w', newline='', encoding='utf-8') as csvfile: writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for data in all_perfume_data: writer.writerow(data) print('Data saved to:', csv_file)