Start studying: Saturday, December 7th Books used: Miyuki Oshige "Details! Python3 Introductory Note ”(Sotec, 2017)
Resume from [Retrieving values from dictionary (Ch.9 / p.229)](7th day), Finished until [Text file (Ch.13 / p.316) (partially reserved)](8th day)
>>>def Arnold():
return "When my muscles say "No", I say "Yes!""
>>>Arnold()
"When my muscles say "No", I say "Yes!"
・ It is also possible to set arguments -If defined first, the pass can be stated in the statement for the time being. -The function definition is a closed space, and ** variables set in the definition ** cannot be referenced from the outside. -You can set a variable value by adding * before the argument. (By convention, it is expressed as * args, etc.) -** Module is created using def function ** (Not all? However, there is a description that the def file that defines yen-dollar conversion can be imported and used, so interpret it as such) ・ You can see the explanation of the function with help () (although it is new). You can go back by pressing ** q **.
>>>muscles = ["biceps","triceps","abdominal","deltoid","gluteus"]
>>>muscles_iter = iter(muscles)
>>>next(muscles)
"biceps"
>>>next(muscles)
"triceps"
#Omission
#If there are no elements to retrieve, an error will occur at the end.
-The generator is a similar process, but it seems to have the advantage of requiring less memory. I'm not sure, but I'm optimistic that I can feel it when it's time to use it.
on hold
-Open with open (), read with read (), and close with close (). To avoid errors, it is a good rule to close the read number first before processing it. -If it is a with-as statement, there is no need to close (). (Open with open and define as) ・ When I read html with tkinter, the amount was too large and it got stuck ... It seems that if you continue reading, you can read as many as the specified number. -All if the argument of read () is blank or a negative number. If you enter a positive number, only that sentence. Or readline () -How to check if there is a save destination and a file using filedialog
Recommended Posts