- import csv
- def save_to_csv(entries, filename):
- with open(filename, "w", newline="") as file:
- writer = csv.writer(file)
- writer.writerows(entries)
- def main():
- # Your existing code to retrieve and print the data goes here...
- # Assuming 'csvfile' contains the CSV data as a string
- csvfile = """
- Branch,Line,Line_Description,Registered_Sales,Unit_Sales,Explained_wastage,Explained_wastage_Quality,Reductions_Sterl
- 101 Bishop's Stortford,2105,WR Ess Rich Tea Finger Biscuits 250g,£19.55,23,£0.00,£0.00,£0.00
- 101 Bishop's Stortford,2124,WR Ess Cream Crackers 300g,£28.00,40,£0.00,£0.00,£0.00
- 101 Bishop's Stortford,2141,WR Ess Garibaldi Biscuits 200g,£22.95,17,£0.00,£0.00,£0.00
- 101 Bishop's Stortford,2144,WR Ess Shortcake Biscuits 400g,£15.00,12,£0.00,£0.00,£0.00
- """
- # Extract entries
- entries = [line.split(",") for line in csvfile.strip().split("\n")]
- # Save to CSV with custom filename
- custom_filename = "custom_sales_data.csv"
- save_to_csv(entries, custom_filename)
- print(f"Data saved to {custom_filename}")
- if __name__ == "__main__":
- main()
[text] A
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: