# Writing in to CSV file PROBLEM

Discussion created by ajit.nayak87 on Dec 8, 2013
Latest reply on Dec 11, 2013 by hua17
Dear all,

I have below piece of code and output window . I could not able to write in to CSV file

output:
```['date is:7/12/16', 'time is:24-0-0', 'Zenith:104.85', 'Azimuth:110.40', 'Elevation:-14.85', 'Converted Elevation:15.79', '']
date is:7/12/16
time is:24-0-0
Zenith:104.85
Azimuth:110.40
Elevation:-14.85
Converted Elevation:15.79

['date is', '7/12/16\r\ntime is', '24-0-0\r\nZenith', '104.85\r\nAzimuth', '110.40\r\nElevation', '-14.85\r\nConverted Elevation', '15.79\r\n']

['date is:7/12/16', 'time is:24-0-0', 'Zenith:104.85', 'Azimuth:110.40', 'Elevation:-14.85', 'Converted Elevation:15.79', '']

```

code:
```import serial
import csv
import string
import os
import time
import sys

def main():
pass

if __name__ == '__main__':
main()
count=0
f=open("test.csv","w+");
result = csv.writer(f,delimiter=',', dialect='excel-tab')

result_statememt=("date","time","Zenith","Azimuth","Elevation","conv_elevation");
result.writerow(result_statememt)
f.close()
while(count<5):
#time.sleep(60)
ser=serial.Serial()
ser.port=2
ser.baudrate=9600
ser.open()
print str
val=str.split(":")
print val
print "\n"
lines=str.split("\r\n")
print lines
f=open("test.csv","a+")
result=csv.writer(f,delimiter=',')

count=count+1

#lines=str.split("\r\n")

#print count
#f=open("test.txt","a+")
#result=csv.writer(f,delimiter=',')
#result.writerow()
f.close()

f.close()
ser.close()

```