python开发_python中的list操作
发布时间:2020-12-17 00:18:08 所属栏目:Python 来源:网络整理
导读:对python中list的操作,大家可以参考: [ , , ,1,3,5 [x x range(1,10 s != test_listA = ( * 50 test_listB = ( * 50 test_listC = ( * 50 test_str = test_listD = == main() Python 3.3.2 (v3.3.2:d047928ae3f6,May 16 2013,00:03:43) [MSC v.1600 32 , >
对python中list的操作,大家可以参考:
[,,,1,3,5
[x x range(1,10
s !=
test_listA = ( * 50 test_listB = ( * 50 test_listC = ( * 50 test_str =
test_listD =
== main()
Python 3.3.2 (v3.3.2:d047928ae3f6,May 16 2013,00:03:43) [MSC v.1600 32, >>> ================================ RESTART ================================
>>>
[,5
[1,2,4,5,6,7,8,9
[, ,,,,,,,,,,,,,,,,>>>
下面有更多的demo: <div class="cnblogs_code"> Python 3.3.2 (v3.3.2:d047928ae3f6,00:03:43) [MSC v.1600 32 Type , >>> counter = 100
>>> miles = 1000.0
>>> name =
>>> numberA,numberB,nameC = 1,
>>> list = >>> [100,1000.0,, >>>
>>> element
100
1000.0
1
2
>>>
>>> (list[0])
100
>>> (list[-1])
>>> (len(list))
6
>>> num_inc_list = range(10)
>>> range(0,10 >>> inc_list
1
2
3
4
5
6
7
8
9
>>>
>>> initial_value = 10
>>> list_length = 5
>>> myList = [initial_value i range(10 >>> [10,10,10 >>> list_length = 2
>>> myList = myList * >>> [10,10 >>> 20
>>>
>>>
>>>
>>> copyList = [1, >>> copyList = copyList * >>> 8
>>> cl
1
2
3
1
2
3
>>>
>>>
>>> test_list = [,, >>> 7
>>> (test_list[0])
>>>
>>> (test_list[-1])
>>> (test_list[-len])
File ,line 1, |