Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
csv file output
#7
import pickle
import csv

with open('file.csv','a',newline="") as f:
    thewriter=csv.writer(f)

    thewriter.writerow([' name',' adult','child','reference'])
        

ref=-1
av_seats=152

while True:    
    ad=int(input("Enter a  adult "))

    ch=int(input("Enter a  children "))
    name=input("Plese enter your name")

    totoal=ad+ch

    av_seats=av_seats-totoal
    ref=ref+1

    thewriter.writerow([name,ad,ch,ref])



    print("left are ",av_seats)
   
    op=input("press 'n' to terminate or any key to stop ").lower()
    if op=='n':
        break
Reply


Messages In This Thread
csv file output - by rturus - Jan-30-2020, 10:16 AM
RE: csv file output - by buran - Jan-30-2020, 10:36 AM
RE: csv file output - by rturus - Jan-30-2020, 11:30 AM
RE: csv file output - by buran - Jan-30-2020, 11:38 AM
RE: csv file output - by rturus - Jan-30-2020, 12:23 PM
RE: csv file output - by buran - Jan-30-2020, 12:25 PM
RE: csv file output - by rturus - Jan-30-2020, 02:00 PM
RE: csv file output - by buran - Jan-30-2020, 02:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,160 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Output CSV file with filepath and file contents glittergirl 1 1,788 Aug-03-2020, 01:50 AM
Last Post: glittergirl
  File name as part of output file name Jeeping_Coder 1 2,150 Jan-10-2020, 03:43 PM
Last Post: Clunk_Head
  How to extract a matrix from .xml.gz file to a excel file or any other output? enyrb 0 2,089 Oct-21-2019, 01:01 PM
Last Post: enyrb
  python file output to log file Rsh 4 3,752 Aug-13-2019, 09:00 PM
Last Post: DeaD_EyE
  Output SQL to csv or xls file? JP_ROMANO 4 2,641 Aug-02-2019, 01:58 AM
Last Post: JP_ROMANO

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020