last day (15 days later) » 

8:03 PM
0
A: Saving output result in tabular format in same file or different file

John HowardUse the csv.writer method. It works similar to the csv.reader method you used earlier in your code in that you can specify a delimiter, in this case '\t', meaning a tab. This will split each item by a tab when you write it. This is assuming you are trying to write to a csv file. If not, and you ...

 
I tried csv.writer option.But the issue I am facing is the result isnt getting stored in the file..
 
Well I'm not sure what your new code looks like, but in your current code ` h = open("test.txt", "w")` opens the file to write but you never actually write anything to it.
 
I have added my current edit to the main query/program.
 
Take a look at the docs I linked in my answer. When you create a csv.writer object it doesn't actually write stuff until you call writerow. So in your case spamwriter.writerow(row).
Also watch out you are creating a csv.writer each time in your for-loop, it should be made outside then have it write a row each iteration.
 
HI,I tried to edit it,but still no table is saved in file.I will edit the main query to show you how my program looks now.
 
8:03 PM
I edited my answer
 
Sorry for the trouble,but the .csv file is still empty for me..
 
sorry messed up the indentation it should work now
 
I am checking it.
hi
I dont know but it is still not showing.
 
8:36 PM
dont know what to tell you, im running that exact code and it works
must be something wrong with how you are running it or something
 
8:48 PM
okk I am checking out
thanks
 
9:19 PM
I tried many times,but it seems its not working.Anyways,thanks for the help :).
 

last day (15 days later) »