Q. What is following code doing?

file = open("contacts.csv", "a")

name = input("Please enter name.")

phno = input("Please enter phone number.")

file.write (name + "," + phone + "\n")


Answer :- 

It will take data from user and write data in file ‘contacts.csv’.


13 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Thank you so much for the solution

    ReplyDelete
  2. We cant use write () in csv file right?

    ReplyDelete
  3. Brah You are being so Helpful from Starting of Class 11th ... Now its Mid term of Class 12th .. You are still being Helpful being a Anonymous to me .. Thank You Bro : )

    ReplyDelete
  4. Thank you for being helpful in the exam times . I have my exams day after tomorrow and i am grateful to you for posting all these solutions .

    ReplyDelete
  5. i have a doubt . will this code not give an error in general ? because csv.writer() is not imported??

    ReplyDelete
  6. Thanks a lot for your solutions! They help me a lot! Kudos to the efforts :)

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post