7 ответов
+ 1
Can you post your code showing your attempt at solving this please?
+ 1
Yes
0
Just a minute, gonna paste
0
# SP=Selling Price
# cgst=central govt gst
# sgst=state govt gst
import os
import csv
import sys
busn=input("Enter Your Business Name ")
item=input("Enter Item Name ")
SP=float(input("Enter selling price of item "+item+": "))
gstRate=float(input("Enter GST Rate (%): "))
cgst=SP*((gstRate/2)/100)
sgst=cgst
amt=SP+cgst+sgst # Consumer will buy at this price
print("\t",busn)
print("\t INVOICE")
print("\tItem:",item) with open('data.csv','w',
print("\tPrice:",SP)
print("\tCGST(@",(gstRate/2),"%):",cgst)
print("\tSGST(@",(gstRate/2),"%):",sgst)
print("\tAmount payable:",amt)
0
i want the data which is going to print should be exported in a text file,,,,
0
Okay well after you open a csv file youd need a csv writer.
writer = csv.writer()
I beleive.
Then it needs to write an iterable of values.
each value being a different cell in the same row.
You may also want to make a list of the categories and write them first so theyll be at the top
0
Then loop through with writer.writerow() or writer.writerows() depending on your setup.