We first open the Idle Select file->new Window command (or you can directly press CTRL + N, in many places this button is the new file meaning)
Here is still to recommend my own built Python development Learning Group: 725479218, the group is the development of Python, if you are learning Python, small series welcome you to join, everyone is the software Development Party, not regularly share dry goods (only Python software development-related), Including a copy of my own. 2018 Latest Python Advanced materials and high-level development tutorials, welcome to the next step and into Python's small partners
We fill in the code:
Save the file is the key shortcut key Ctrl+s, save the source code as a hello.py file
Press F5 to run (and we can choose the Run->run Module command).
An error appears in idle :
The reason is that the name 'name' is undefined
Note: You need a long underline here to make it correct, to distinguish the syntax of the python itself
After the correction we run again:
We saw the same results as before.
We'll modify the Web connection to see what happens:
The result is "produce an exception"
Explain the generic code framework: The GET method requests a link that r.raise_for_status to determine whether the request is normal (that is, 200), otherwise an exception is generated. r.encoding = r.apparent_encoding This sentence is able to be our request to return the page decoding is correct, and finally return the content of the page.
This framework is used to solve the problem of our visiting the webpage.
Today's content is this, a little bit every day, the heavy insist. Come on!!!
Life is too Short Crawler crawl Web page of the General code framework