Magic string day-9 (a)

! # / the User / bin / env / Python 
# - * - Coding: UTF-8 - * -

# ==================== a ====== ====================

# capitalize ()
the Test = 'alex'
# capitalized
v = test.capitalize ()
Print (v)


# ===== =============== two ==========================

# casefold ()
# change all lowercase
# casefold support many unknown but some correspondence may also become lowercase
test1 = 'ALEX'
v1 = test1.casefold ()
Print (v1)

# Lower ()
# only supports common
test2 = 'ALEX'
v2 = test2.lower ( )
Print (v2)


# ==================== three ======================= ===,

# V = xxx.center (XX, 'Eee')
# Center (XX) value write brackets
# set the width, and the center the contents
# representative length XX
# # Eee representative of the empty space is filled only fill a character
test = 'alex'
test.center = V (20 is, '*')
Print (V)

# V = xxx.center (XX)
# set the width, and the center the contents
# XX representative length
# character only fill a
back fill without showing the rest # blank
Test = 'Alex'
V = test.center (20 is)
Print (V)


# ==================== four ========= =================

# COUNT ( 'X ")
# string is used to find the number of occurrences of a subsequence
Test =' alexalexr '
V = test.count (' F ' )
Print (V)

# represents the seek plus 5 bits from the fifth does not include 5
Test = 'alexalexr'
V = test.count ( 'A', 5)
Print (V)

# 6 was added represents from fifth to sixth Looking five
Test = 'alexalexr'
V = test.count ( 'A', 5,6)
Print (V)


# ==================== four === =======================

# endsWith ( 'X') Represents the end of string is what
# returns a boolean
test = 'alex'
test.endswith = V ( 'X')
Print (V)

# startsWith ( 'X') represents the beginning of the string is what
# returns a Boolean value
Test = 'Alex'
V = test.startswith ( 'A')
Print (V )

Guess you like

Origin www.cnblogs.com/pythonzhao/p/11701235.html