Python Basic Tutorial Summary 2--string

1. Basic operationSequence operations: Index, Shard, multiply, Judge membership, length, Max ...Note: The string is immutable and the Shard assignment is illegal2. String formattingTemplateWhen formatting a string, Python uses a string as a template.

Python AES Encryption decryption

AES encrypted block packet length must be 128 bits, the key length can be 128 bits, 192 bits, 256 bits of any one (if the data block and key length is insufficient, will be filled). AES encryption has many rounds of repetition and transformation.

Python how to manipulate date and time

No matter when and where, as long as we are programmed to encounter time-related problems, we have to think of the datetime and the standard library module, today we will use its internal methods, detailed Python operation date and time method.1.

Flask---Another lightweight web framework for Python

Flask is another lightweight web framework in Python, with nearly 15000 star on GitHub. GitHub address is flaskThe usage is very similar to bottle and is interesting to refer to Bottle-python's lightweight HTTP

Python Object-oriented inheritance

Nothing to say, inheritance is mainly inherited by some parents, the code is very specific#!/usr/bin/env python #coding: Utf-8class Father (object): #新式类 def __init__ (self): self.name= ' Liu ' self . Familyname= ' Yan '

Traps for Python class private methods

IntroductionPython does not define member functions or properties like C + +, Java, C #, etc. with explicit public, private, or protected keywords, which are identified using the Convention's single underscore "_" and "__" double underscores as a

Python's zip function

@Python zip functionThe ZIP function accepts any number of sequences (including 0 and 1) as parameters, returning a tuple list. The specific meaning is not good to express in words, directly look at the example:1. Example 1:x = [1, 2, 3]y = [4, 5, 6]

Python core Programming chapter sixth Exercise 6-12

6-12.String.(a) Create a function with the name FINDCHR (), which is declared below.Def findchr (String, char)FINDCHR () to look up the character char in string strings, find it to return the worthy index, otherwise return-1. You cannot use

Python uses timestamps

1. Convert the time of a string to a timestamp method: a = "2013-10-10 23:40:00" to convert it to a time array importtime Timearray = Time.strptim E (A, "%y-%m-%d%h:%m:%s") converted to timestamp: timeStamp = Int (time.mktime (timearray)) TimeStamp =

string handling in Python

Python escape characterPython uses a backslash (\) to escape characters when special characters are needed in characters. As the following table: Escape Character Description \ (at end of line) Line

The decorations in Python

In the object-oriented (OOP) design pattern, the decorator is called the adornment mode. The Deco pattern of OOP needs to be implemented through inheritance and composition, while Python supports decorator directly from the syntax level, in addition

[Python learning] two, using platform Python on Linux

In this section, it describes how Linux uses platform python1. Python installation.Today, most of the Python's own version number, it cannot be installed. Suppose you want to install it, you can use the appropriate installation instructions.Fedora:

Python----format

1/cmd command under Python Development Mode Exit method: Ctrl + Z2/natural string preceded by the string R, for example R "hello/n", you can retain the escape character3/String Repeat *n4/SUBSTRING: index, slice5. Set: Establish relationship (&

The fabric of the Python module

Fabric is a Python library and command-line tool designed to make it more efficient and convenient to use the pipelined operations of SSH for application deployment and system management tasks. Fabric provides a basic set of operations for

Execute python "/bin/usr/python:bad interpreter:no such file or directory" error

Today, I wrote a Python script on the computer, and then I wrote it with FTP, then executed the/var/www/cron.py, the result error,/bin/usr/python:bad interpreter:no such file or directory, Before the implementation of the python/var/www/cron.py is

Compute the SU procedure time with Python

#!/usr/bin/python2.6Import Re,datetimeFile_name= ' Sim.log 'File=open (file_name, ' R ')Acnum=[];time_res=[];lnum=0def trans_time (time):T1=datetime.datetime.strptime (Time, '%y/%m/%d%h:%m:%s ')return T1for (Num,line) in enumerate (file):if

Python implements the reciprocal calculation method, and python implements reciprocal calculation.

Python implements the reciprocal calculation method, and python implements reciprocal calculation. This example describes how to calculate the countdown in python. Share it with you for your reference. The details are as follows: class Expr: def

Talking about the closure in Python and talking about the closure in Python

Talking about the closure in Python and talking about the closure in Python In my opinion, the concept of closure in Python is equivalent to defining one or more functions in a function. The inner function defines the specific implementation method,

Python Data Structure-Details of graph depth-first and breadth-first instances, python Data Structure

Python Data Structure-Details of graph depth-first and breadth-first instances, python Data Structure This document describes how to prioritize the depth and breadth of a python data structure. Share it with you for your reference. The details are

Python converts numbers into Chinese characters,

Python converts numbers into Chinese characters, At home on weekends, I wrote a small program to convert Arabic numerals into uppercase Chinese. The program has not been optimized, and has gone through detailed tests. It is mounted to the internet

Total Pages: 4013 1 .... 1274 1275 1276 1277 1278 .... 4013 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.