mirror of
https://gitlab.rlp.net/pgp/pgp1-python-einfuehrung
synced 2024-11-16 13:48:11 +00:00
Einlesen mit csv-Package: Beispiel geaendert, so dass es zum Skript passt (Ohne enum)
This commit is contained in:
parent
4606b48cf2
commit
4bb9da9c59
1 changed files with 7 additions and 8 deletions
|
@ -256,7 +256,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 10,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2019-10-06T09:14:47.437191Z",
|
"end_time": "2019-10-06T09:14:47.437191Z",
|
||||||
|
@ -274,16 +274,15 @@
|
||||||
"with open(pfad) as csvfile:\n",
|
"with open(pfad) as csvfile:\n",
|
||||||
" readCSV = csv.reader(csvfile, delimiter='\\t')\n",
|
" readCSV = csv.reader(csvfile, delimiter='\\t')\n",
|
||||||
" \n",
|
" \n",
|
||||||
" for ind, row in enumerate(readCSV): # <-- enumerate ordnet jeder eingelesenen Zeile einen index zu\n",
|
" n = 3 # Anzahl der Headerzeilen, die übersprungen werden müssen\n",
|
||||||
|
" for i in range(n):\n",
|
||||||
|
" next(readCSV) # Zeilen auslesen, aber icht weiterverarbeiten\n",
|
||||||
" \n",
|
" \n",
|
||||||
" if ind < 3: # <-- Solang der Index kleiner als 3 ist befinden wir uns noch im Header\n",
|
" for row in readCSV: # restliche Zeilen mit Daten auslesen und in Liste speichern \n",
|
||||||
" continue # <-- Deshlab wollen wir, dass nichts passiert. Dies erreichen wir mit\n",
|
|
||||||
" # continue \n",
|
|
||||||
" \n",
|
|
||||||
" messwertnummer = float(row[0])\n",
|
" messwertnummer = float(row[0])\n",
|
||||||
" hallspannung = float(row[1].replace(',', '.')) \n",
|
" hallspannung = float(row[1].replace(',', '.')) \n",
|
||||||
" Messwertnummer.append(messwertnummer)\n",
|
" Messwertnummer.append(messwertnummer)\n",
|
||||||
" Hallspannung.append(hallspannung)"
|
" Hallspannung.append(hallspannung)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue