「Python3」リスト(list)の使い方

サンプルコード

#!/usr/bin/python3
 
list = [ 'abcd', 786 , 2.23, 'testdata', 70.2 ]
cftLst = [123, 'testdata']
 
print (list)            
print (list[0])         
print (list[1:3])      
print (list[2:])       
print (cftLst * 2)    
print (list + cftLst)

実行結果:
['abcd’, 786, 2.23, 'testdata’, 70.2]
abcd
[786, 2.23]
[2.23, 'testdata’, 70.2]
[123, 'testdata’, 123, 'testdata’]
['abcd’, 786, 2.23, 'testdata’, 70.2, 123, 'testdata’]

Python

Posted by arkgame