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’.
Print(2*2)
ReplyDelete4
DeleteThank you so much for the solution
ReplyDeleteWelcome : )
DeleteWe cant use write () in csv file right?
ReplyDeleteYes.
DeleteBrah 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 : )
ReplyDeleteWelcome : )
DeleteThank 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 .
ReplyDeleteWelcome : )
Deletei have a doubt . will this code not give an error in general ? because csv.writer() is not imported??
ReplyDeleteYes. you have to import csv library.
DeleteThanks a lot for your solutions! They help me a lot! Kudos to the efforts :)
ReplyDeletein the last line we should not use phone we have to use phno
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )