Python data Structure-string

Source: Internet
Author: User

String:
" "
‘‘‘ ‘‘‘
‘ ‘
Ordered indexable sql= "select" Sql[4]=c
Iterate lst=list (SQL) =["s", "E", "L", "E", "C", "T"]
String connection: "Connector". Join (the element is an iterative object of type String)------> return a new string
String connection: "str1" + "STR2"------> Returns a new string
String splitting: "string". Split (["Delimiter =none"],[maxsplit=-1])-------> return element is a list of string types None white space character: "\ r \ n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1
"String". Rsplit ("[Sep=none]", [maxsplit=-1])------> cut from the right, returns an element that is a string of type list None white space character: "\ n \ t \r,-1 by default it can cut a few knives
"String". Splitline ("Sep=none", maxsplit)-----> return element is a list of string types None line break: \ n \r-1 The default is to cut a few knives.
String segmentation: "". partition (["Sep=none"])-------> return element is a tuple of string type (Head.sep.tail) None white space character: "\ t \ n \ r
"String". Partition ("Sep")-------> return element is a tuple of string type (Head.sep.tail) delimiter must be specified to keep the delimiter cut into two parts divided into three segments
"String". Partition ("Sep")-------> Start cutting from the right. The return element is a tuple of string type (Head.sep.tail) delimiter must be specified to cut a knife delimiter to remain cut into two parts divided into three sections
String modification: "string". Replace (Old,new,[count])----> Returns a new string
"String". Strip ([chars])----> Returns a new string
String lookup: "string". Find (Sub,[start,stop])-----> Return index number, cannot find return-1
"String". RFind (Sub,[start,stop])-----> Find from right, return index number, cannot find return-1
"String". Index (Sub,[start,stop])-----> Return index number, return index number, no error found
"String". Rindex (Sub,[start,stop])-----> Search from the right, return index number, return index number, no error found
String length: Len ("str")----->int length
String count: Count ("str", [start,stop])-----> occurrences
String judgment: "". StartsWith (Sub,[start,stop])----->bool
"". EndsWith (Sub,[start,stop])------>bool
String case: "". Lower ()
"". Upper ()
"". Title ()
". Capitalize ()

String is series
"String". Isalnum ()----->bool is not just numbers and letters
"String". Isalpha ()----->bool is not only the alphabet
"String". IsDigit ()------>bool is not just a number
"String". Isupper ()------->bool is not a word embox uppercase
"String". Islower ()-------->bool is not a word embox lowercase
"String". Isspace ()------->bool are not all whitespace characters
"String". Isdentifier ()------>bool is not the identifier letter and the underscore begins with other alphanumeric underscores

字符串格式化---format函数"{}{***}".format(*args,**kwargs)----->str:<左对齐   > 默认右对齐   ^居中:2 宽度为2 :0>2 填充  宽度为2 其余用0填充:.2f 浮点数 精度为2 四舍五入:3.3%:d 十进制:x 十六进制:o 八进制:b 二进制

Python data Structure-string

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.