import math csvfile = file("sample.csv", "w") for count in range(10): csvfile.write( str(count) + "," ) csvfile.write( str(count*count) + "," ) csvfile.write( str(math.sqrt(count)) + "\n" ) csvfile.close()