1. Operation of the file:
Operation
Explain
Output=open (R ' C:\123.txt ', ' W ')
Create output file, W write
Input=open (' Data ', ' R ')
Create output file, R read
Input=open ('
#-*-coding:utf-8-*-x =set ()Printtype (x)# defines an empty collectionx=['a','a','C','D']x=set (x)Printx#set ([' A ', ' C ', ' d ']) list, setPrintlen (x)#3 Length of the output setPrint 'a' inchx#True To specify whether the element is in the
ex1.py1 Print "Hello world!"2 Print "Hello Qiwei"3 Print "I like typing this."4 Print "This was fun ."5 Print 'yay! Printing.'6 Print "I ' d much rather you ' not '."7 Print 'I "said" do not touch this.'ex2.py Comments and Pound characters1 #A
About judging and looping statementsPython's judgment and looping statements are very intuitive and read close to natural language.Judgment statement ifThe standard if statement is the following structure:if expression: if_suiteIf expression is
From the university began to play Python to work now for 5 years, now the company is a. NET company with less Python, recently the company has a new project needs to use Python, the leadership hope I come with other colleagues training, there is
List-generated and multi-level expressions in PythonHow do I generate a list of [1x1, 2x2, 3x3, ..., 10x10]?1 l=[]; 2 for in range (1,one):3 l.append (x*x)4 Print L 5 print ("+++++++++ is not beautiful" the importance of the indentation of
Create
Two methodsThe first type:>>> a={}//DECLARE type First>>> a[' a ']=1>>> A{' A ': 1}The second type:>>> b={' A ': 1, ' B ': 2}//create directly>>> b{' A ': 1, ' B ': 2}2. DeleteDelete Develop Key-value>>> del b[' B ']>>> b{' A ': 1}Empty
Continuing the pytest of the unit test framework,pytest can generate multiple types of test reports. This section will learn how pytest generates test reports. Create the test_calss.py test case file, as an example of testing the file.
The properties of Python classes and objects are divided into class and object properties, which are classes, and object properties belong to the object.1. The object properties of the parent class are inherited by the object of the quilt class.2.
Python has three built-in functions: Lists, tuples, and strings, which convert each other using three functions, str (), tuple (), and List (), as shown below:
>>> s = "xxxxx">>> List (s)[' x ', ' x ', ' x ', ' x ', ' X ']>>> tuple (
There are a number of Windows systems need to monitor, both Zabbix, Nagios need to install the relevant plug-ins, the operation is more troublesome.Python's Psutil module monitors Linux, Windows, Macs, and so on across platforms, then uses Python to
At first there is this demand, is because the YAH3C replacement INode for Campus network certification, has been compiled error, the hint can not find a Python module, Baidu a bit, this module is in Python2.7 above only, But the system's own Python
Hash Table Learning notesReference translation from: "Complexity thinking" and the corresponding online version: http://greenteapress.com/complexity/html/thinkcomplexity004.htmlUse hash tables for very fast lookup operations, time constants, and no
On the internet for a long time, there is no ideal solution. The main idea, using the regular Expression re.split () segmentation, while using Re.findall () to find the delimiter, and then link the two.# coding:utf-8import sysreload (SYS)
Scene:String at the beginning or end of a match, typically using a matching file type or URLGeneral use of Startwith or Endwith>>> a= ' http://blog.csdn.net/raylee2007 ' >>> a.startswith (' http ') TrueNote: The parameters in both methods can be str
How to Use 200 lines of Python code "face change"
Introduction
This article describes how to write a Python script with only 200 lines to "face" for two portraits ".
This process can be divided into four steps:
Detects facial markers.
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