Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def write_to_csv(product_data):
- # Open the CSV file for writing
- with open('products.csv', 'w', newline='', encoding='utf-8') as csvfile:
- # Define the field names for the CSV header
- fieldnames = ['Product Name', 'Price']
- # Create a DictWriter object
- writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement