Python path day2 string function

Source: Internet
Author: User

1 #Author:ersa2 3Name ="Ersa"4 5 #Initial Capital capitalize ()6 Print(Name.capitalize ())7 8Name ="My name is Ersa"9 #number of substring repeats in stringTen Print(Name.count ("a")) One  A #The Center () string prints the output in the middle and specifies the print length, which is not enough to complement other characters - Print(Name.center (50,'-')) -  the #endswith () determine what the string ends with? Output True or False - Print(Name.endswith ("SA")) -  - #Expandtabs () specifies that the TAB key is converted to more than one space +Name ="my \tname is Ersa" - Print(Name.expandtabs (tabsize=20)) +  A #find () finds where the string is located at Print(Name.find ("y")) -  - #strings can be used directly as lists - Print(Name[name.find ("name"):]) -  -Name ="My name is {name} a I am {year} old" in #format () formatted output - Print(Name.format (name="Ersa", year=33)) to  + #the Format_map () parameter can be dict - Print(Name.format_map ({'name':'Ersa',' Year': 22})) the  * #isalnum () Whether it is Arabic numerals $ Print('123'. Isalnum ())#TruePanax Notoginseng Print('123#$'. Isalnum ())#False - Print('ab123'. Isalnum ())#True the  + #isalpha () uppercase and lowercase letters A Print('ABCA'. Isalpha ())#True the  + #Isdecimal () is a decimal number - Print('123'. Isdecimal ())#True $  $ #IsDigit () is a number - Print('123'. IsDigit ())#True -  the #Isidentifier () is a valid identifier (variable name) - Print('AB1'. Isidentifier ())#TrueWuyi Print('1AB1'. Isidentifier ())#False the  - #Islower () Whether it is a lowercase letter Wu Print('AbC'. Islower ())#False -  About #Isupper () is uppercase $ Print('My Name'. Isupper ())#False -  -  - #IsNumeric () is a number A Print('3.3'. IsNumeric ())#False + Print(' -'. IsNumeric ())#True the  - #isspace () is a space $ Print(' '. Isspace ())#True the Print('a'. Isspace ())#False the  the #Istitle () whether the title the Print('My name'. Istitle ())#False - Print('My Name'. Istitle ())#True in  the #isprintable () printable the Print('a'. Isprintable ())#True TTY fiel,drive file is not printable About  the #join () give the user input parameters as a command to Os.system to execute the #Import Os,sys the #Os.system (". Join (sys.argv[1:])) +  - Print('+'. Join (['1','2','3'])) the Bayi Print(Name.ljust (50,'*')) the Print(Name.rjust (50,'-')) the  - #uppercase and lowercase conversions - Print('Ersa'. Lower ()) the Print('Ersa'. Upper ()) the  the #remove carriage returns before and after characters in a string the Print('\nersa'. Lstrip ()) - Print('ersa\n'. Rstrip ()) the Print('ersa\n'. Strip ()) the  the Print('------')94  the #replace the corresponding character thep = Str.maketrans ("abcdef","123456") the Print("Ersa Ma". Translate (p))98  About #Replace - Print('Ersa Ma'. replace ('a','A', 1))101 Print('Ersa Ma'. replace ('a','A'))102 103 #Find and find the right-most corresponding subscript to return104 Print('Ersa Ma'. RFind ('a')) the 106 #Specify delimiter107 Print('Ersa Ma'. Split ('s'))108 Print('1+2+3+4'. Split ('+'))109 Print('1+2\n+3+4'. Splitlines ()) the 111 #string to uppercase the Print('Ersa Ma'. Swapcase ())113  the Print('Ersa Ma'. Title ()) the  the #zfill with 0 padding117 Print('Ersa Ma'. Zfill (10))

Python path day2 string function

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.