Added: 9th day of learning python

String Gray Magic: The index for slicing cycle len

 

# Index, index, obtain a certain character string 
test1 = "laonanhai"
# V = test1 [. 1]
# Print (V)

# slice
# v = test1 [0: -1 ] # represents the starting value is greater than or equal 0 less than the last one (not including the last -1)
# Print (v)

#len python3 man is a character, python2.7 a man three characters
test2 = "old boy"
v1 = len (test1)
v2 = len (test2)
Print (v1, v2)

test = "old boy cattle B" 
COUNT = 0
the while COUNT <len (Test):
V = Test [COUNT]
Print (V)
COUNT = +. 1
#for variable name in the string
for test1 in Test:
Print (test1)

 

Guess you like

Origin www.cnblogs.com/jianchixuexu/p/11440856.html
9th