Python Web server and crawler acquisition

Source: Internet
Author: User

The difficulties encountered:

1. python3.6 installation, it is necessary to remove the previous completely clean, the default installation directory is: C:\Users\ song \appdata\local\programs\python

2. Configuration variables There are two Python versions in the PATH environment variable, environment variables: add C:\Users\ song \appdata\local\programs\python\python36-32 in Path

Then PIP configuration: Path in, Environment add: C:\Users\ song \appdata\local\programs\python\python36-32\scripts

3. Open the command prompt in the current folder Shift + right click on PowerShell is, go to D disk D: Return to the previous level directory CD. There are two points after

4. Python does not have Chinese in computer name when doing Web server

5. Python In the background code:

Pip install Flask Download the framework from the command prompt

Written in Python

From flask import Flask #用框架搭环境

App = Flask (__name__)

@app. Route ('/') #装饰器对应一个url网址
Def home (): #一个方法
Return ' Songkang ' #返回值给网页

if __name__ = = ' __main__ ':
App.run (host= ' 0.0.0.0 ', port=80,debug=true) #域名, 80 ports

localhost Access in browser

5.1 Using Python code to extract data from a database and instill it in a Web page

6. Crawler Get wallpaper Environment installed BS4:PIP install BEAUTIFULSOUP4

7. Basic: Sum ([+ +]) add

Tuple tuples (All-in-all) immutable, fast

Array [+/-] Variable

Python 2 distinguishes long int float python3 not distinguished by int

Type (ss) to see what type of Help (sum) to see how to use

Python Web server and crawler acquisition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.