Python data type

Source: Internet
Author: User

"  def capitalize (self): Capital letter" Print ("Hello"). Capitalize ())

"Def Center (self, Width, fillchar=none): Content centered, Width: total length; Fillchar: padding content in blank, default No"

Print ("*". Center (page, "!")) "Def count (self, sub, Start=none, End=none): Number of subsequence ' A =" Yueoe we "Print (A.count (" E ", 0, 5) "Decode Code" "A =" [email protected] "B = a.encode (encoding = ' GBK ') print (b) ' Def expandtabs (self, tabsize=none): t AB convert spaces, default 8 spaces ' A = ' abc\tdef ' Print (A.expandtabs (1)) ' Find (self, sub, start=none, End=none) find sub-sequence position, if not found, return-1 "a = "ABCABCDDD" Print (A.find ("B", 4, 8) "Def index (self, sub, Start=none, End=none) looking for sub-sequence position, if not found, error" a = "abcabcddd" Print (A.index ("B", 4, 8) "Def join (self, iterable) connection" ' str = "-" seq = "abc" Print (Str.join (seq)) # with "-" Connection "abc" "Def Ljust (self, width, fillchar=none) content left-aligned, right-filled "print" ("abc". Ljust ("*")) ' Def lstrip (self, chars=none) remove left blank " Print ("Def". Lstrip ()) "IsDigit () true:unicode number, byte digit (single byte), Full width digit (double byte), Roman numeral false: Kanji digit error: no Isdecimal () True: Unicode digits, full-width digits (double-byte) false: Roman numerals, Chinese numerals error:byte digits (single byte) isnumeric () True:unicode digits, full-width digits (double-byte), Roman numerals, Chinese numerals false: no error: byte digit (single byte) "" "Def Lower (self): variable lowercase ' print (" AbCdef ". Lower ())" Def Swapcase (self): case Conversion ' Print ("AbCdeF". Swapcase ()) "Def isupper (self) is uppercase" print ("ABC"). Isupper ()) print ("ABc". Isupper ()) "Def partition (self, SEP): Split, before, in, and after three sections ' Print (" Abcdefghijk ". Partition (" EF ")) #" EF "Splits the string into three parts, the second part is its own print (" Abcdefghijk ". Partition (" O ")) # no" O "is found and the first part is all shown, the second and third parts are divided into empty ' Def split (self, sep=none, Maxsplit=none) split, maxsplit up to several "print" ("Abc-def-hij-kmn". Split ("-", 2)) ' Def splitlines (self, keepends=false): str1 = ' ab c\n\nde fg\rkl\r\n ' # default newline character is not split according to line break print (Str1.splitlines ()) str2 = ' ab c\n\nde fg\rkl\r\n ' # if True, then Keep line break print (Str2.splitlines (True)) "Def Replace" (self, old, new, Count=none), count is the maximum number of replacements ' Print (" abcdefabc123abc456 ". Replace (" abc "," T ")) Print (" abcdefabc123abc456 ". Replace (" abc "," T ", 2)) # Replaces no more than 2" def StartsWith (self, prefix, Start=none, End=none): Whether to start "print" ("Boreas". StartsWith ("B")) Print ("Boreas". StartsWith ("E ", 3, 5)) # from position 3-5 see if" E "is the start" def translate (self, table, Deletechars=none): conversion, requiredTo make a corresponding table, 2.x the last one represents the deletion of the character set, 3.x without this parameter "Trantab = Str.maketrans (" Aeiou "," 12345 ") s =" This is a string EXAMPLE....WOW!!! " Print (S.translate (trantab))
Str

4324234

Python data type

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.