Data base types and commands for Python

Source: Internet
Author: User

In : determine if a character is in a string

Not ni: determine if something is in something

Base: convert to Binary

bit_length : Binary of the current number, at least in several representations

capitalize: Initial Capitalization if there are other uppercase characters in the string, it becomes lowercase

Casefold: Turn all the lowercase

Lower: just turn English into lowercase

Center: Set the width and center the character

Center (Width,fillchar)

Count: indicates the number of characters that appear

count ("_", Start,end)

EndsWith: endswith (self,suffix,start,end) indicates the judgment or not of what to start or end with.

StartsWith: Starswith (self,suffix,start,end) indicates the judgment or not of what to start or end with.

Find: Find (self,sub,star,end) from the beginning, and perhaps its location

format : Format (*args,**kargs) to replace placeholders in a string with the specified values

For example:

test='I love {you}'print(test) v=test.format (you="She  ")print(v)

Format_map: formatted, passed in value {"abc": "Def", "a": "A")

isalnum: determines that the string contains only alphanumeric

isalpha: Determine if the string is a letter

Isdecimal: Judging whether a string is a number (judging ② is not a number)

isdigit: determine if the string is a number (you can tell ② is a number)

isnumeric: Determine if the string is a number (both the two and 2 types of ② and Chinese are judged to be numbers)

islower: determine if lowercase

Lower: Convert to lowercase

isupper: Judging capitalization

Upper: converting to uppercase

isprintable: does not print if an invisible, such as newline character \ n, is present in the print

Isspace: Determines whether the string is a space, if not all the space is wrong

istitle: determine if the first letter in the title is uppercase

Title : Convert the first letter in the title to uppercase

join: Separate the strings

For example:

A="  iloveyou"b="_"= B.join (a) Print (v) _i_l_o_v_e_y_o_u

rjust: rjust (Self,width,fillchar) fill in the front of a string

Lstrip:rstrip:strip: Remove the space on the left or right side of the character or blank line or specify the character in the brackets below to remove it

Maketrans: Substitution of correspondence relation

Partition: Divide the string into three parts

swapcase: Conversion of size

Data base types and commands for Python

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.