Q. Write a function that reads a csv file and creates another csv file with the same content, but with a different delimiter.
Answer :-
import csv def Pathwalla( file1 ): file2 = open( "Portalexpress.csv","w",newline="" ) portal_write = csv.writer( file2 , delimiter = "|") data = csv.reader(file1) for i in data : if i[0][:5] != "check" : portal_write.writerow( i ) file2.close() file1 = open( "Pathwalla.csv","r" ) Pathwalla( file1 ) print ("Thank You !!")
Content in Pathwalla.csv :-
This is Path Wall Website. check here you find all solution Tell me about you check are you fine Ok thankyou
Output :-
Thank You !!
>>>
>>>
Content in Portalexpress.csv after program running:-
This is Path Wall Website. Tell me about you Ok thankyou
but thats not the csv file you have done in txt file? why so?
ReplyDeletePlease go carefully with code whole program have written for csv file.
DeleteYou are done in a csv file but you are saved in a txt file.why??
ReplyDeleteIt will not affect the output.
DeleteCsv file use
ReplyDeleteOk, I have done it.
Deletedifferent question different answer.......
ReplyDeletewhat happened.
DeleteThe question is different and the answer is different too. This answer is for the question after this one
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )