I am trying to write mean,var,std to a .txt file but I am getting an error.
import csv
mean = 50.00001075309713
var = 4.120598729047652
std = 2.0299257939756448
with open('Radius.txt', 'w+') as f:
writer = csv.writer(f)
print("Mean =",mean)
print("var =",var)
print("std =",std)
writer.writerow(mean)
writer.writerow(var)
writer.writerow(std)
The error is
in <module>
writer.writerow(mean)
Error: iterable expected, not float
The expected output is
mean = 50.00001075309713
var = 4.120598729047652
std = 2.0299257939756448
floatis not iterable, so you need to wrap it in an iterable container like alistor atuple.