Some gadgets for text processing
Requirementspython 3.6+
1. Randomly extracting text by row# 从指定文件中随机取出一定行数python shuffle.py --input_file input_file --output_file output_file --number line_number# 从指定文件中随机取出一定百分比的内容 (按行): parameter:
Please first look at Learning Tornado, write the custom paging class: The idea is consistent;Python---Custom page-out classes1. Basic use:Background Data acquisition: fromdjango.core.paginator import paginator,pagenotaninteger,emptypage# error
Set properties:Variable, unordered, non-repeating set of elementsCollection definitions = set () s = set (range) #set (iterable)Collection elementsSet element requirements must be hash the currently learned non-hash type has list, set element can
we need to shut down some unnecessary services when initializing the system, keep some of our commonly used, such as sshd, network, etc., to close the system services more, then we need to borrow script to complete the task. Just learned the basics
Arithmetic topic generation-Console basedProject hosted in the code cloud: airline TicketsDemand analysis
According to the console prompt information, enter the topic to generate the relevant configuration parameters
Number of
Welcome to follow Me blog: Cloud DreamerDescribeThe index () method detects whether a substring contains substrings in str, and if you specify beg (start) and end (end) ranges, the check is contained within the specified range, just like the Python
Python monitor remote host (according to the MU class network hand-hit)1. Get the information for the computer you want to monitorOs.system (' command ') Direct output resultsOs.popen (' command ') returns a fileOpen ('/proc/file ') cpuinfo file
Python image processingFrom PIL import Image"" Open Picture "" "Pil_im=image.open (' test1.jpg '). Convert (' L ') #打开图片, followed by function to turn gray#print (Pil_im) #打印图片属性GF"" "Change the image size" "#pil_im. Thumbnail ((1000,1000))
Ready to work: Pip Install DDTKnowledge Points:One, data-driven and code-driven:Data-driven means testing according to the data you provide, such as the ATP Framework requires test cases in ExcelCode-driven is the code that must be written to test,
" "determine if the two files are the same, if different please indicate the number of lines is not the same" "deff1vsf2 (name1,name2): F1=Open (name1) F2=Open (name2) Count= 1msg=[] forLine1inchF1:line2=F2.readline ()if(line1!=line2):
such as testing the code, does not have the intersection of Li, li_ query outli=[1,2,3,4,5]li_=[2,5,6,7,9] for in li_: if in li: li_.remove (i)print li_# Output [5, 6, 7, 9]ReasonFor a For traversal list, the index position of the
In Python's function, you will occasionally see the last line of the function definition with a @functionname modifier, and when the interpreter reads the modifier of @, it will parse the contents of the @ after it, and directly put the function or
This article mainly to share with you two Python to realize the switch function, hope to help everyone.
# when installed, use activate to activate an environment.Activate Python34 # for WindowsSOURCE Activate Python34 # for Linux & Mac# after
This article is mainly to share with you python to get human face code sharing, I hope you can complete python according to this article to get the function of human face.
Usage:python getface.py src out
#-*-Codeing:utf-8-*-import sysimport
This article is mainly to share with you the example of Python parsing json, mainly in the form of code and we explain, hope to help everyone
JSON (JavaScript object Notation, JS tag) is a lightweight data interchange format.Python uses JSON
This article is mainly to share with you the basic knowledge of Python grammar, hope to help everyone.
Python comments
' Multiline comment ', ' single-line comment '
Python2 If there is a Chinese language in the document, it must be adjusted (two
Full-stack Python development: python iterator, generator, and python GeneratorIterator 1. What is iterator?
# The iterator is an iteration tool. What is iteration? # Iteration is a repetitive process. Each iteration is an iteration, and the result
Day01: The Path to Python: The Path to day01python1. What language is Python?
Python is a dynamically interpreted language with a strong type definition.
(1) Dynamic and Static languages
① Static language: a language that performs data type check
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