remove tempfiles

This commit is contained in:
llnu 2020-05-25 17:00:44 +02:00
parent e2cf1a9865
commit 19e417310c
3 changed files with 0 additions and 54 deletions

View file

@ -1,32 +0,0 @@
* 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.

View file

@ -1 +0,0 @@
user@1lnu.12786

View file

@ -1,21 +0,0 @@
import sys
script, input_encoding, error = sys.argv
def main(language_file, encoding, errors):
line = language_file.readline()
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)