返回列表 發帖

串列 (一)

假設有一串列其內容如下:
list=["忠","孝","仁","愛","信","義","和","平"]

試取出串列中的第1到第5個元素

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

  1. list=["booo","yaaay","hello","blaahhhh"]
  2. print(list[0:1])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["Hudson","IS","dumb","stupid","noob","and trash"]
  2. print(list[0:6])
複製代碼

TOP

  1. list=["Raymond","is","stupid","dumb","very stupid","noob","trash"]
  2. print(list[0:6])
複製代碼

TOP

  1. list["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list:["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

list1=["Moo","Woof","Meow","Chirp","Fumperdink"]
print (list1 [4:5])
#Why are we still here, just to suffer.

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:-2])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼
._.

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:4])
複製代碼

TOP

返回列表