Cat Ning! ! !
Reference links: Yi Ling -21 micro lesson easily grasp the compulsory entry zero-based python - priced at 29 yuan
https://www.liaoxuefeng.com/wiki/1016959663602400
Day 10: Advanced Data Structure
Yi Ling micro lesson - Video authors conclude very well be re-study the knowledge points before, and this is very important for learning python late.
All relevant knowledge are some points in the previous nine-day course.
Pv and calculate the size of the site log uv
By the middle tab separated, ceshi.txt, followed by the page name and page id
The first one is separated by a space, a tab separated after three, this must be followed, otherwise the program will complain, ceshi1.txt, followed by a log time, user id, event id, event
First ceshi.txt into a dictionary
Continue processing ceshi1.txt
Left tuples, also a dictionary key, the right is a dictionary, result [key] = {} will achieve a dictionary into the right
Further data acquisition
The result is
result.txt content
Eleventh day: Code Organization
Code organizational structure
Block - Function - class - modules / files - package - projects, from small to large.
Reusable blocks of code, a name named, can conveniently be called elsewhere, to achieve complex code logic package.
The most basic function
result
Function equation
result
Incoming characters to the tuple, the letters in quotes is also possible to replace digital
result
Unpacking array
show result
Changes in the function list
result
Global Variables
result
Global modification x
result
Twelfth Day: Code Organization
Review pv, uv-function code and the code is divided into three orderly. Code problems, some see an error, most of the time the code is run manually knocking on the wrong lead to failure.
And the result is the same as before
lambda functions, also known as word function, easy to call for some advanced functions
Sort results
sort Sort, Sort by results, sorted by student number
Sort sorted
ok, this is the contents of the first 10-12 days, the relevant pv, uv is also part of the code have about 50 lines, in-depth understanding of the more important.