ich moechte eine txt.datei verwenden, die folgendermassen aussieht (40 Zeilen * 41 Spalten):
Wenn ich versuche diese Datei in Python hochzuladen
Code: Alles auswählen
import numpy as np
data = np.loadtxt(Pfad/entfernuungstabelle_Deutschland_koord.txt' )
# data = np.loadtxt('/home/noise/ericho/Desktop/entfernuungstabelle_Deutschland_koord.txt', usecols = np.arange(1,41)) # Entferne 0-Spalte da hier text steht
Code: Alles auswählen
/usr/lib64/python3.6/site-packages/numpy/lib/npyio.py in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin, encoding)
1052 try:
1053 while not first_vals:
-> 1054 first_line = next(fh)
1055 first_vals = split_line(first_line)
1056 except StopIteration:
/usr/lib64/python3.6/codecs.py in decode(self, input, final)
319 # decode input (taking the buffer into account)
320 data = self.buffer + input
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
322 # keep undecoded input until the next call
323 self.buffer = data[consumed:]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 3317: invalid start byte