Python in front of a few words meaning

Source: Internet
Author: User

Slice

Str[start:end:step]

Start: Starting from xxx (startswith)

End: Cut to XXX (EndsWith) not included

. Capitalize () #首字母大写

. Title () #标题, capitalize the first letter of each word (special characters, Chinese is also considered special characters here)

. Upper () #转换成大写字母

. Lower () #全部成小写

. Swapcase () #大小写转换

. Center (value) is elongated to 10 characters, filled by *

. Strip () #去掉左右两边空格

. Lstrip () #去掉左边空格

. Rstrip () #去掉右边空格

. replace () # replacement

. Split () #切割

. Count () #数数

. Find () #查找

. Index () #索引位置

. StartsWith () #是否以什么开头

. EndsWith () #是否以什么结尾

. Isalnum () #是否由数字和字母组成

. Isdgit () #是否以数字开头

. IsNumeric () #是否全是数字

. Isalpha () #是否由字母组成

Len () #判断字符串长度

List

. Append () # Append

. Insert () #插入

. Extend () #扩展

The list also has slices

. Pop () #弹出最后一个, or specify content

. Remove () #删除

The. Clear () #清空列表

Del #切片删除 del is a keyword

The. Sort () #升序

. Reverse () #翻转 (or descending)

Meta-group

Range can help us get to a set of data that can be obtained through a For loop,

Add: dic[' key ']= ' value ' (existing on modification, not present is new addition)

Dic.setdefault (' key ')

. SetDefault (' key ', ' value ') #新增

. SetDefault (' key ', ' value ') #存在不执行任何操作

. Popitem () #随机删除

The. Get () #查询

". Join (LST) #把列表变成字符串, concatenate the list with the preceding string, return the string

R Read-only mode

W Write-only mode

A Append write mode

r+ read/write mode (emphasis)

w+ Read-write mode (not commonly used)

A + append read/write mode (not commonly used)

Strip (except for removing spaces. You can also wrap)

Python in front of a few words meaning

Related Article

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.