12/27/2023 0 Comments Shaw python![]() ![]() ![]() I'll try to answer your questions in order: Raw_bytes = next_lang.encode(encoding, errors=errors)Ĭooked_string = raw_code(encoding, errors=errors) Next_lang = line.strip() # what is strip? If it does not (AKA if it's false), then it won't. If line: # if line has something from what it is defined to be it will run the below. Line = language_file.readline() #defining line as a read off of language_file Here is the full scrip uninterrupted without my comments: def main(language_file, encoding, errors): Any help to dissect this would be greatly appreciated. I think this exercise is a bit premature in this book or I'm just not seeing something. Why is it languages vs language_file? main(languages, input_encoding, error) Languages = open("languages.txt", encoding = "utf - 8") What does the strip function do? What does errors=errors mean? cooked_string = raw_code(encoding, errors=errors)Ĭooked_string we are defining as taking the raw bytes and encoding it.I think? print(raw_bytes, "", cooked_string) Zed defined print_line below but uses it above? What does return main do? Does it mean that we return back to the base function? def print_line(line, encoding, errors): How can I get away with creating an if statement without defining the function in it above? Is there something I'm missing. The if line has something from what it is defined to be it will run the below. Return main(language_file, encoding, errors) How is language_file being defined? I don't see a definition anywhere? if line: Define line to read the line off the language file. def main(language_file, encoding, errors):ĭefining the function titled main with three variables. This is simple, we are just importing sys and defining argv's variables. import sys script, input_encoding, error = sys.argv I'll try and explain what I can based on what I see, but I am unsure if I understand everything here. A few of these topics seem premature/ he didn't go over it yet, and he mentions that this is on the harder end than anything I've seen but I'm getting consistently lost. This script deals with him trying to teach you how to decode and encode letters in different languages it seems. I'm trying to decipher Zed's ex23 and his explanation is somewhat helpful but I'm getting lost. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |