Merge remote-tracking branch 'balazs/master'

This commit is contained in:
Nico Schottelius 2020-05-25 17:02:01 +02:00
commit c3e4f0307e
4 changed files with 154 additions and 0 deletions

View file

@ -0,0 +1,25 @@
import sys
script, input_encoding, error = sys.argv
print (sys.argv)
def main(language_file, encoding, errors):
line = language_file.readline()
print (line)
if line:
print_line(line, encoding, errors)
return main(language_file, encoding, errors)
def print_line(line, encoding, errors):
next_lang = line.strip()
raw_bytes = next_lang.encode(encoding, errors=errors)
cooked_string = raw_bytes.decode(encoding, errors=errors)
print(raw_bytes, "<===>", cooked_string)
languages = open("languages.txt", encoding="utf-8")
main(languages, input_encoding, error)

View file

@ -0,0 +1,97 @@
Afrikaans
አማርኛ
Аҧсшәа
العربية
Aragonés
Arpetan
Azərbaycanca
Bamanankan
বাংলা
Bân-lâm-gú
Беларуская
Български
Boarisch
Bosanski
Буряад
Català
Чӑвашла
Čeština
Cymraeg
Dansk
Deutsch
Eesti
Ελληνικά
Español
Esperanto
فارسی
Français
Frysk
Gaelg
Gàidhlig
Galego
한국어
Հայերեն
हिन्दी
Hrvatski
Ido
Interlingua
Italiano
עברית
ಕನ್ನಡ
Kapampangan
ქართული
Қазақша
Kreyòl ayisyen
Latgaļu
Latina
Latviešu
Lëtzebuergesch
Lietuvių
Magyar
Македонски
Malti
मराठी
მარგალური
مازِرونی
Bahasa Melayu
Монгол
Nederlands
नेपाल भाषा
日本語
Norsk bokmål
Nouormand
Occitan
Oʻzbekcha/ўзбекча
ਪੰਜਾਬੀ
پنجابی
پښتو
Plattdüütsch
Polski
Português
Română
Romani
Русский
Seeltersk
Shqip
Simple English
Slovenčina
کوردیی ناوەندی
Српски / srpski
Suomi
Svenska
Tagalog
தமிழ்
ภาษาไทย
Taqbaylit
Татарча/tatarça
తెలుగు
Тоҷикӣ
Türkçe
Українська
اردو
Tiếng Việt
Võro
文言
吴语
ייִדיש
中文

View file

@ -0,0 +1,32 @@
* Questions:
** How does the program reads the file?
readline
** How does it loops over the lines?
readline will return an empty string when no more data is available
*** https://stackoverflow.com/questions/28936140/use-readline-to-read-txt-file-python3
** Why doesnt he uses a for loop? (instead of return) -later
Good to know:
"The second method still reads the file line by line and does not load the whole file into memory, right? nishant Nov 14 '19 at 7:24"
"@nishant correct Ilan Kleiman Dec 15 '19 at 1:42"
** What is "with" in python? -later
** Why should I use builting python utils instead of *nix utils? -later
* Notes:
strip: for text formatting
* Log:
Takes a long time to watch the video.