赞
踩
- list1 = [1, 2, 3, 4, 5] # define list
-
- # After list1.append() operations
-
- print('without index')
- for value in list1:
- print(value, end=' ')
-
- print()
-
- print('with index ①')
- for index in range(len(list1)):
- print(f'list1[{index}] = {list1[index]}')
-
- print('with index ②')
- i = 0
- for value in list1:
- print(f'list1[{i}] = {value}')
- i += 1
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。