I first met python, and I feel so good, I can’t help but want to learn

python

Python (Pyson) feels very popular in recent years, but it was first released in 1991, 5 years older than the http 1.0 protocol, and 4 years older than the well-known java ! It's a bit surprising.
Although I have not used python in my work, it does not affect my learning and understanding of this language.

The python 3 released at the end of 2008 is not fully compatible with python 2; it has the slogan that "the one who uses python 2 and python 3 is not the same".

What can you do

The most popular functions in the IT world can be connected.

  • Of course, the one I hear most is used to do web crawlers !
  • Data processing .
  • Scientific computing .
  • Machine learning .
  • It can also do daily tasks, such as automatically backing up your MP3.
  • It can be used as a website. Many famous websites like Zhihu and YouTube are written in Python.
  • It can be used as the background of online games. Many online games are developed in Python.
  • It can also be used for other high-concurrency projects, etc., only you can't think of it, without him (the last half sentence is bragging).

Features

  • Simple
    Python is a language that represents simple ideas.
  • Easy to learn
    Python has an extremely simple syntax, and all variables need to be declared before use.
  • Free & open source
    Python is one of FLOSS (free/open source software).
  • High-level language
    When writing programs in Python, there is no need to consider low-level details such as how to manage the memory used by the program.
  • High portability
    Python has been ported to many platforms, including Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, AS/400, BeOS, OS/390, z/OS, Palm OS, QNX, VMS, Psion, Acom RISC OS, VxWorks, PlayStation, Sharp Zaurus, Windows CE and even PocketPC.
  • Explanatory
    Can be run directly from the source code. Inside the computer, the python interpreter converts the source code into an intermediate form of bytecode, and then translates it into the machine language used by the computer.
  • Object-oriented
    python supports both process-oriented programming and object-oriented programming.
  • Scalability
    Some programs can be written in other languages, such as c/c++.
  • Embeddable type
    Python can be embedded into c/c++ programs to provide scripting functions.
  • The
    Python standard library is indeed huge. It can help you deal with various tasks, including regular expressions, document generation, unit testing, threads, databases, web browsers, CGI, FTP, email, XML, XML-RPC, HTML, WAV files, password systems, GUI (Graphical user interface), Tk and other system-related operations.

Life is too short

Because the use of python development has the advantages of small amount of code, low maintenance cost, and high programming efficiency; using python will have more time to soak girls!

Life is short, I use python!

good pal

Raspberry Pi Click to Jump
The main development language of Raspberry Pi uses python.

General users may not be familiar with the Raspberry Pi, but this little guy born under the name of an ultra-cheap computer has been favored by technology houses due to its high degree of customization and playability. Since its launch in 2012 The sales volume has reached 12.5 million yuan.
This is a milestone number, because as the world’s third-largest computer platform, the historical cumulative sales of Commodore 64 is 12.5 million units. Since Commodore 64 was discontinued as early as 1993, the Raspberry Pi can be ranked third in the world Up.
Top two? Of course it is Windows and Mac.

development tools

  • IDLEpython自带调试编辑器,二级考试用此
  • jupyter notebook 方便的集成开发环境
  • Visual Studio Code 项目开发推荐使用

Try it out

Crawl Sina News homepage news.
We need to extract unstructured data from the network and convert it into structured data .
The requests library is mainly used to send requests for data, and the BeautifulSoup library parses the data.

import requests #导入requests库
res = requests.get('http://news.sina.com.cn')
res.encoding='utf-8'

from bs4 import BeautifulSoup #导入BeautifulSoup 库
soup = BeautifulSoup(res.text,'html.parser')
syncad= soup.select('#syncad_1')[0].select('h1')
for news in syncad:
    for a in news:
        print(news.text+':'+a['href'])

Insert picture description here

Guess you like

Origin blog.csdn.net/u011513460/article/details/105652734