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]
>>>

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...