2025年3月4日上課Python 陣列array串列的函數(方法)

利用w3schools練習的python指令

animal = ["豬", "牛", "羊", '貓']
#python語言的註解comments
x = animal.copy()
print(animal)
x.reverse() #將x反轉reverse
print(x)
animal.append('狗')
print(animal)
y = animal.copy()
y.reverse() #將x反轉reverse
print(y)
  
Python 說明或範例JavaScript
len() len(list) # 串列 list 長度list.length;
append()list.append(’ 加元素’)list.push(’ 加元素’)
clear() list.clear() # 移除所有元素
copy()a = list.copy() # 拷貝至新串列 a
count() list.clear() # 移除所有元素 list.count(’ 豬頭’) #list=[’ 豬頭’,...]?
extend() list.extend([’ 豬頭’,’ 狗屎’])# 合併 (延伸) 串列 a=list.concat([’ 豬頭’,’ 狗屎’])
index()
insert() list.index(’ 豬頭’) # 元素第一次出現的位置 0, 1, 2... list.indexOf(’ 豬頭’) list.insert(k,’ 豬頭’)# 位置 k 前插入元素’ 豬頭’
pop() list.pop(k) # 移除位置 k 元素
remove() list.remove(’ 豬頭’) # 移除第一次出現的’ 豬頭’ reverse() list.reverse()# 將元素次序反轉 list.slice(k,k + 1) list.reverse()
sort() list.sort()# 將元素排序list.sort()

GOOGLE COLAB執行程式

嵌入EMBED影片與網頁

留言

  1. https://lin-yujing.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  2. https://sincewayne.blogspot.com/2025/03/202534python-array.html

    回覆刪除
  3. https://www.w3schools.com/python/trypython.asp?filename=demo_default

    回覆刪除
  4. https://chenyenhsun.blogspot.com/2025/03/pythonarraylist.html

    回覆刪除
  5. https://gbsddik.blogspot.com/2025/03/python.html

    回覆刪除
  6. https://mumeng-ru.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  7. https://huutingyu.blogspot.com/2025/03/h1background-colorpurplecolorwhitepaddi.html

    回覆刪除
  8. https://draft.blogger.com/blog/post/edit/4336680755326581508/5015279057378528774

    回覆刪除
  9. https://chiuerya0515.blogspot.com/2025/03/34.html

    回覆刪除
  10. https://xu-bing-wei-0804.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  11. https://zyixnn.blogspot.com/2025/03/34.html

    回覆刪除
  12. https://takuto20050803.blogspot.com/2025/03/python-array.html

    回覆刪除
  13. https://jiachiangkuo.blogspot.com/2025/03/34.html

    回覆刪除
  14. https://xu-bing-wei-0804.blogspot.com/2025/03/animal-pythoncomments-x-animal_3.html

    回覆刪除
  15. https://zhang-1108.blogspot.com/2025/03/34.html

    回覆刪除
  16. https://chinenkohana.blogspot.com/2025/03/blog-post.html

    回覆刪除
  17. https://yimignsocool.blogspot.com/2025/03/blog-post.html

    回覆刪除
  18. https://huuiiiiman.blogspot.com/2025/03/202534python-array.html

    回覆刪除
  19. https://slu804387.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  20. https://yuweiiiiiiiiiiii.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  21. https://vovo8564513.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  22. https://christina-lqw.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  23. https://takming123.blogspot.com/2025/03/202534python-array.html

    回覆刪除
  24. https://zyixnn.blogspot.com/2025/03/h1background-colorpinkcolorwhitepadding.html

    回覆刪除
  25. https://zhuo-1005.blogspot.com/2025/03/blog-post.html

    回覆刪除
  26. https://lu-cheng-yin-2024.blogspot.com/2025/03/34.html

    回覆刪除
  27. https://pei940922.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  28. https://xuan-ang.blogspot.com/2025/03/python-array.htm

    回覆刪除
  29. https://chan0528.blogspot.com/2025/03/animal-pythoncomments-x-animal.html

    回覆刪除
  30. https://sccabout.blogspot.com/2025/03/202534python-array.html

    回覆刪除
  31. 作者已經移除這則留言。

    回覆刪除
  32. https://d11117315111.blogspot.com/2025/03/202534python-array.html

    回覆刪除
  33. https://yangyoyo0125.blogspot.com/2025/04/202534python-array.html

    回覆刪除
  34. https://d11117242.blogspot.com/2025/04/htmlcssjavascriptjavapython.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

劉任昌python串列List(陣列Array),元組Tuple,集合Set,字典Dict

劉任昌Javascript物件導向Python物件導向