2018年12月24日 星期一

Python List


my_list = list()
my_list.append(12)
print ("my_list.append(12)")
print (my_list)

my_list.extend([1,2,3,4])
print ("my_list.extend([1,2,3,4])")
print (my_list)

my_list.remove(1)
print ("my_list.remove(1)")
print (my_list)

del my_list[0]
print ("del my_list[0]")
print (my_list)

my_list.append(12)                                                                                                      
[12]                                                                                                                    
my_list.extend([1,2,3,4])                                                                                               
[12, 1, 2, 3, 4]                                                                                                        
my_list.remove(1)                                                                                                       
[12, 2, 3, 4]                                                                                                           
del my_list[0]                                                                                                          
[2, 3, 4]                                                                                                               
                                                                                                                        
                                                                                                                        
...Program finished with exit code 0                                                                                    

======== RESTART: D:/數值分析/PYTHON/others/oth-1.py ============
my_list.append(12)
[12]
my_list.extend([1,2,3,4])
[12, 1, 2, 3, 4]
my_list.remove(1)
[12, 2, 3, 4]
del my_list[0]
[2, 3, 4]
>>>

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...