wie ihr unschwer erkennen könnt bin ich ein absoluter Anfänger welcher dazu noch ratlos ist...
Ich möchte eine CSV mit datenset´s füttern, das klappt auch schon allerdings wenn ich die CSV öffne habe ich die eingegebenen Daten zig mal untereinander stehen....
Hier der Code:
Code: Alles auswählen
__author__ = 'Mike'
import csv
def add_column():
print("Add a new column, follow the introduction....")
name_column = str(input("Enter the name of the new column: "))
type_column = str(input("Enter the type ot the new column (e.g. RP,NP,SAX,WAX,CIRAL: "))
lenght_column = input("Enter the lenght of the new column [mm]: ")
dia_column = input("Enter the diameter of the new column: ")
porsize_column = input("Enter the poresize of the new column: ")
particlesize_column = input("Enter the particlesize of the new column [µm]: ")
dataset_column= '%s,%s,%s,%s,%s,%s' %(name_column,type_column,lenght_column,dia_column,porsize_column,particlesize_column)
fobj = open("column.csv", "w")
for engl in dataset_column:
fobj.write( dataset_column + "\n")
fobj.close()
add_column()
So, jetzt frag ich mich natürlich warum dort so viele gleiche Datensätze auftauchen und nicht nur eine.test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
test,rp,100,5,100,3
gruß
Mike
