Use methods of subprocess, re module, logging, package, etc

subprocess ''' subprocess: sub: son Process: process You can send commands to the operating system terminal through python code and return the results ''' import subprocess while True: #1. Let users input terminal commands cmd_str = input('Please input terminal command: '). strip() #Popen(cmd command, shell=True, ...

Posted on Tue, 19 Nov 2019 07:56:05 -0500 by 2oMst

Instantiation parameters of Flask and configuration of app

Catalog 1. Preliminary test of commissioning mode 2. Details of other configuration parameters in app.config 3. Modify the config configuration method (from object usage) 3.1 modify app.config directly: 3.2 import by class: 4. Details of instantiation configuration parameters in flas ...

Posted on Tue, 19 Nov 2019 02:46:10 -0500 by whatwhat123

Python logging module logging

Official documents: https://docs.python.org/2/library/logging.html I. log level The logging module provides a standard log interface, which can record our daily operations and store logs of various formats. The log level of logging is from low to high as debug(), info(), warning(), error() and critical() CRITICAL(50) > ERROR(40) > WAR ...

Posted on Mon, 18 Nov 2019 04:50:41 -0500 by Kenwio

Example of GPT partition using parted partition tool in Linux

Using parted and gdisk tools to GPT partition the hard disk has the same final effect. If it is a solid-state drive, the partition of the hard disk will be 4K aligned by default using parted. Basic configuration example: Before configuration, use fdisk -l to make sure your linux system has an empty hard disk [root@localhost ~]# ...

Posted on Sat, 16 Nov 2019 12:35:09 -0500 by eneficus

python base (20): serialization, json module, pickle module

1. Serialization What is serialization - The process of converting an original dictionary, list, etc. into a string is called serialization. 1.1 Why serialization Why convert other data types to strings?Because only bytes can be transmitted over the network,Only bytes and STRs can be stored in the file. For example, one of the data we calculate ...

Posted on Fri, 08 Nov 2019 21:41:45 -0500 by helppy

Programming job 20191104082520 (branch and jump) to blog

1 Write a program to read the input, stop reading the #character, and report the number of spaces, line breaks, and all other characters read. #include<stdio.h> int main(void) { char ch; int e=0,n=0; while( (ch=getchar())!='#' ){ if( ch=='e' ) e=1; else{ if( ch=='i' & ...

Posted on Thu, 07 Nov 2019 21:07:13 -0500 by Buddha443556

Java get file code

Almost no method is absolutely correct to detect the file coding by certain means without informing the file coding. Only the success rate. 1. The following are several commonly used methods for identifying file codes. Common encoding file starts to identify file encoding: ANSI: no format definition Unicode: the first two bytes are FFFE Unico ...

Posted on Sun, 03 Nov 2019 00:17:03 -0400 by wilorichie

Theory + practice: LVM and disk quota

[TOC] Preface: LVM is the abbreviation of logical volume management. It is a mechanism of partition management in Linux environment. It realizes the file system to span different disks and partitions. Its working principle is to connect several disk partitions into a whole volume group, create the logical volume group on the volume group at wi ...

Posted on Sat, 02 Nov 2019 12:39:25 -0400 by millwardt

C + + common operations

I. string 1. Split string String.split() String has a way to split the string. split(). But if there is a written string, it needs to be escaped to split, otherwise it will make an error. String to be escaped:. $| () [{^? * + \ \ there are 12 special characters in total. If you want to split a string with these char ...

Posted on Fri, 01 Nov 2019 11:18:28 -0400 by delfa

Python basic 1-data type & basic operator

Interaction with users python3 medium input saves whatever the user enters as a string type   python2 medium Raw? Input will save anything the user enters as a string type name=raw_input('>>>>>>>>>>>>>>>>>>>>>>>>>>>>: ') >>>:egon >>& ...

Posted on Thu, 31 Oct 2019 18:30:09 -0400 by craigerjs