1. range(object):
""" range(stop) -> range object range(start, stop[, step]) -> range object Return an object that produces a sequence of integers from start (inclusive) to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1. start defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3. These are exactly the valid indices for a list of 4 elements. When step is given, it specifies the increment (or decrement).
a = 'TjkdFGklfsaYYY'for i in range(0,len(a)): #range(0,len(a))效果一样 print(i,a[i])___________________0 T1 j2 k3 d4 F5 G6 k7 l8 f9 s10 a11 Y12 Y13 Y
加入range()步长
a = input(".....")for i in range(0,len(a)): print(i,a[i])————————.....djklajs k0 d1 j2 k3 l4 a5 j6 s7 8 k
a = input(".....")for i in range(0,len(a),3): print(i,a[i])______________.....jdkfskjkfdsl0 j3 f6 j9 d
2. len(*args, **kwargs): # real signature unknown
""" Return the number of items in a container.
a1 = 'TjkdFGklfsaYYY'a2 = [1,2,3,4,5,'jflkas']b1 = len(a1)b2 = len(a2)print(b1,b2)------------------14 6
3. 脚标
a = 'TjkdFGklfsaYYY'index = 0while index < len(a): b = a[index] print(b) index += 1____________________TjkdFGklfsaYYY
a1 = 'TjkdFGklfsaYYY'a2 = [1,2,3,4,5,'jflkas']print(a1[2], a2[3])————————————k 4