Code: Alles auswählen
michi@michi-debian:~/python$ locale-gen
bash: locale-gen: Kommando nicht gefunden.
Code: Alles auswählen
[michi@michi-debian:~/python$ locale -a
C
C.UTF-8
de_DE.utf8
POSIX
Code: Alles auswählen
michi@michi-debian:~/python$ python ru-uebersetzung.py
Traceback (most recent call last):
File "ru-uebersetzung.py", line 5, in <module>
for line in datei:
File "/usr/lib/python3.7/fileinput.py", line 252, in __next__
line = self._readline()
File "/usr/lib/python3.7/fileinput.py", line 366, in _readline
return self._readline()
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Code: Alles auswählen
michi@michi-debian:~/python$ less ru-uebersetzung.py
#/usr/bin/python3
import fileinput
import re
datei=fileinput.FileInput("ru-txt.txt",inplace=True,backup=".bak")
for line in datei:
line=re.sub(r"Инструкции","Anleitung",line)
line=re.sub(r"белый","weiss",line)
line=re.sub(r"чернить","schwarz",line)
line=re.sub(r"ряд","Runde",line)
ru-uebersetzung.py (END)