First, prefacePython object-oriented in the concept of inheritance, beginners feel very good, there is a super class, often see, recently do some problems to be understood. Specially record share to later research of small partners, after all, now
Procedure for file operation
Open the file, get the file handle and assign a value to a variable
Manipulating a file with a handle
Close File
The existing files are as follows:Last night the cold family Meconematidae from not
Non-fixed parameters:The role of non-fixed parameters: You can pass a number of parameters in order to prepare for future expansion.In the function, the name-added non-fixed function output is displayed as a dictionary, and the non-fixed function
Exercise 1:# L1 = [11,22,33]# L2 = [22,33,44]# A. Get a list of elements of the same content# B. Gets a list of elements in L1 that are not in the L2# C. Gets a list of elements in L2 that are not in the L1# d. Get elements
1. Reading picturesImport= cv2.imread ('./test.jpg')The picture that is read is Numpy.ndarray format, the value is 0~255, img shape is (picture height, picture width, picture channel number), print value come out to discover channel order is BGR,
IoBecause the CPU and memory speed is much higher than the speed of the peripheral, so in IO programming, there is a serious problem of speed mismatch.If you want to write 100M data to disk, the CPU output 100M data only need 0.01 seconds, but the
#!/usr/bin/env python# *_* Coding=utf-8 *_*"""Desc: File Method#############################File.read () #read ([size]), read at the most size bytes, returned as a string.File.readline () ReadLine ([size]), next line from the file, as a
Sys. argv command line argument list, the first element is the program itself path SYS. exit(nExit the program, exit normally when exiting(0) sys. version get versions information for Python interpreter sys. maxint the largest int value sys. Path
Just open TXT file with open (FileName), always error, always find the content of the file read, and later found that the open () is automatically closed during use. Here's another way to solve this problem.The first method.With Open (FileName) as
Python is an interpreted language, and its source code can be run directly. The Python interpreter interprets the source code as an intermediate language and translates it into a machine code run.1. What's the matter pickling and unpiicklingI
In the Python2 is divided intoClassic class:Class Box:PassNew class:Class Box (object):PassIn Python3, there are only new classes:Class Box:PassIn Python's class, What is self?above example:class.py1 classBox:2 def __init__(self, boxname, size,
CodingBy default, Python 3 source files are encoded in UTF-8 , and all strings are Unicode strings. Of course you can also specify a different encoding for the source file:#-*-coding:cp-1252-*-
Identifier
The first character must be a
There are usually multiple characters in a string in Python, how do I intercept it?Example: name = ' My name is jockey 'We first numbered this string, starting with 0:1. Print a character>>> print (name[0])M>>> print (name[11])J2. Print one of the
1, go to the space and special symbolsCopy the code code as follows: S.strip (). Lstrip (). Rstrip (', ')2. Copying stringsCopy the code code as follows: #strcpy (SSTR1,SSTR2)SSTR1 = ' strcpy 'SSTR2 = SStr1SSTR1 = ' Strcpy2 'Print SSTR23. Connection
1 #-*-coding:utf-8-*-2 " "3 --------------------------------------------4 already has the function: Enter the user name password, the authentication succeeds displays the welcome message, after the mistake three times the permanent lock5 To be
Sesame HTTP: TXT text storage and sesame txt text Storage
The operation of saving data to TXT text is very simple, and the TXT text is almost compatible with any platform, but this has a disadvantage, that is, it is not conducive to retrieval.
Python basics -- for/while LOOP, pythonwhile
Python version: 3.6.2 Operating System: Windows Author: SmallWZQ
During school hours, I often encounter this situation: in order to punish the students, the teacher will say, "XXX, you should first go
Pycharm installation and use, Pycharm Installation and Use
1. Download professional: pycharm-professional-2017.3.3.exe
2. Install Pycharm
Wait until installation is complete
3. Activate and use
Https://jetlicense.nss.im/get key
As follows:
D8
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