Day 6 of 100 Days

Day 6: 2018/05/01

Today’s Topic: Python: A byte of python

Today’s Progress: Start from “Input Output” from files (page 113), then move on to pickle and Unicode. Then I moved on to exceptions (which teaches the “with”). The next step is standard library, and that’s where I ended. (page 127)

Thoughts: In the book, it teaches f = open(…), but I usually do with open (…) as f. Both would work but if I use “with” I don’t have to worry about the close() or exceptions. For pickle, I already know this from work so I am familiar with it. For exception, it’s the usual. Then the book introduced “with” statement, which I already mentioned.
The standard library is a vast topic, I need to come back and study it again.

Notes:

  • pickling = dump(), unpickling = load()
  • io.open(…)
  • only in “text” mode (open(file,’wt’…), you set the encoding=’utf-8’
  • try…except…else ← runs when on error are caught
  • raise exception
  • try… finally…
  • with → thefile.__enter__ when entering the block, then thefile.__exit__ when leaving the block.
  • stdlib: sys sys.version_info
  • stdlib: os, platform, logging
  • os.path.join(….)
  • os.getcwd()
  • if platform.platform().startswtih(‘Windows’):
  • logging.basicConfig(pass in log information)
  • To Do: Go through debuging, argparse, re…

Link to work: Link to my own Google drive to show my progress here.

This entry was posted in 象哥的學習筆記 Study Notes and tagged . Bookmark the permalink.

Leave a Reply