Install python3.7 under centos6.9

“ All of the following operations are based on centos6.9. python3.7Rely on openssl1.0.2, first update the OpenSSL of the system. recommendations Upgrade system to centos7 (system OpenSSL has been upgraded to 1.0.2) install dependency package yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make # 3.7Must be installedYum -y install libffi-devel > SSL Open the SSL module, otherwise all modules that PIP installs HTTPS requests will fail and must be completed before make First configure python, that is to run./configure firs...

Python learning twenty-second days file byte type

    All files are stored in binary form on the computer, but sometimes we need to convert the binary to GBK or UTF-8 form, encode and decode when encoding. Here is a brief description of the role of Python binary in the file transfer process. 1,pythonWhich formats are binary transmission? Video, pictures, music 2,pythonFunction of file binary In the process of network programming, in the process of network transmission, people do not want to see the encoding, can use binary transmission, fast, safe and reliable. 3,pythonBinary usage of files rb,Binary read mode wb,Binary write mode ab...

Python basic eleventh day -re module

reModular common method findall() Returns all eligible results in a list. 1 import re 2 print(re.findall('\d','a1b2c2abc123'))#['1', '2', '2', '1', '2', '3'] View Code search() Finding the first matching information returns an object containing matching information (returning None if not found), which looks at the result through the group () function 1 import re 2 3 str = 'a1b2c2abc123' 4 print(re.search('\d', str).group()) # 1 View Code match() Starting from string, location matching, others with search () 1 import re 2 3 str = 'a1b2c2abc123' 4 print(re.match('\d', s...

Summary of Python—10

Because I taught myself Python while I was at work, once I got busy, Python would put it away for two days, but I forgot what I learned two days later. Today, summarize the various startup methods of Python. My document path: ——-    1Open the CMD where the file is located and tap directly in the command line.python Filename.Py (with.Py file suffix),It can output results directly.      Note: this opens the path directly. The filename.Py is not found.   2Open the CMD where the file is, and on the command line, tap directly: python, first enter the python interaction mo...

Python file object several operation mode difference — file operation method detailed explanation

    Byte mode of file object/b Settings3 set any byte each time. Chinese string Returns a string that can be viewed Write to find string Useseek > Pattern File existence file does not exist operation Document content r Establishopen default isr objects normally open normally. Establishopen objects normally open normally. Establishopen isutf-8 program, read this text file will be wrong, it will use.windows read mode (default).  w. Mode plus‘b’ method returns an integer indicating the current pointer position. f.seek(offset,from_what) sta...

Python grabs the interface and keeps the picture.

import urllib.request import json import os #Import OS module import requests #Import requests module class BeautifulPicture(): def __init__(self): #Class initialization operations self.headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'} #Specify a request header for the request to simulate the Chrome browser. self.folder_path = 'D:\demo\BeautifulPicture' #Set the file directory to which pictures are to be stored. #Using urllib2 to get network data def registerUrl(self): ...

Python—11 module

In the process of computer program development, as more and more program code is written, the code in a file will become longer and longer, more and more difficult to maintain. In order to write maintainable code, we grouped many functions into separate files, so that each file contained relatively little code, and many programming languages used this method of organizing code. In Python, a.Py file is called a module (Module).). What are the advantages of using modules? The biggest benefit is greatly improving the maintainability of the code. Second, writing code does not need to start from s...