Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.List.splice
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Başlangıç dizininden başlayarak listeden sayı öğelerini kaldırır ve diğer öğelerin içeriğini bu konuma ekler. Başlangıç negatifse listenin sonundan geriye doğru sayılır.
Kullanım | İadeler |
---|
List.splice(start, count, other) | Liste |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
bu: list | Liste | |
start | Tamsayı | |
count | Tamsayı | |
other | Liste, varsayılan: null | |
Örnekler
Kod Düzenleyici (JavaScript)
// An ee.List object.
var list = ee.List([0, 1, 2, 3, 4]);
print('Original list', list);
// If "other" argument is null, elements at positions specified by "start" and
// "count" are deleted. Here, the 3rd element is removed.
print('Remove 1 element', list.splice({start: 2, count: 1, other: null}));
// If "start" is negative, the position is from the end of the list.
print('Remove 2nd from last element', list.splice(-2, 1));
// Deletes 3 elements starting at position 1.
print('Remove multiple sequential elements', list.splice(1, 3));
// Insert elements from the "other" list without deleting existing elements
// by specifying the insert "start" position and setting "count" to 0.
print('Insert new elements', list.splice(2, 0, ['X', 'Y', 'Z']));
// Replace existing elements with those from the "other" list by specifying the
// "start" position to replace and the "count" of proceeding elements. If
// length of "other" list is greater than "count", the remaining "other"
// elements are inserted, they do not replace existing elements.
print('Replace elements', list.splice(2, 3, ['X', 'Y', 'Z']));
Python kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
import ee
import geemap.core as geemap
Colab (Python)
# An ee.List object.
ee_list = ee.List([0, 1, 2, 3, 4])
print('Original list:', ee_list.getInfo())
# If "other" argument is None, elements at positions specified by "start" and
# "count" are deleted. Here, the 3rd element is removed.
print('Remove 1 element:',
ee_list.splice(start=2, count=1, other=None).getInfo())
# If "start" is negative, the position is from the end of the list.
print('Remove 2nd from last element:', ee_list.splice(-2, 1).getInfo())
# Deletes 3 elements starting at position 1.
print('Remove multiple sequential elements:', ee_list.splice(1, 3).getInfo())
# Insert elements from the "other" list without deleting existing elements
# by specifying the insert "start" position and setting "count" to 0.
print('Insert new elements:', ee_list.splice(2, 0, ['X', 'Y', 'Z']).getInfo())
# Replace existing elements with those from the "other" list by specifying the
# "start" position to replace and the "count" of proceeding elements. If
# length of "other" list is greater than "count", the remaining "other"
# elements are inserted, they do not replace existing elements.
print('Replace elements:', ee_list.splice(2, 3, ['X', 'Y', 'Z']).getInfo())
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eList.splice()\u003c/code\u003e modifies a list by removing elements and inserting new ones at a specified position.\u003c/p\u003e\n"],["\u003cp\u003eIt takes \u003ccode\u003estart\u003c/code\u003e, \u003ccode\u003ecount\u003c/code\u003e, and \u003ccode\u003eother\u003c/code\u003e as arguments to control the modification process.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003estart\u003c/code\u003e determines the starting position for removal/insertion, while \u003ccode\u003ecount\u003c/code\u003e determines the number of elements to remove.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eother\u003c/code\u003e provides the elements to insert; if \u003ccode\u003eother\u003c/code\u003e is null or None, elements are only removed.\u003c/p\u003e\n"],["\u003cp\u003eA negative \u003ccode\u003estart\u003c/code\u003e value counts backwards from the end of the list for positioning.\u003c/p\u003e\n"]]],[],null,["# ee.List.splice\n\nStarting at the start index, removes count elements from list and insert the contents of other at that location. If start is negative, it counts backwards from the end of the list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------|---------|\n| List.splice`(start, count, `*other*`)` | List |\n\n| Argument | Type | Details |\n|--------------|---------------------|---------|\n| this: `list` | List | |\n| `start` | Integer | |\n| `count` | Integer | |\n| `other` | List, default: null | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// An ee.List object.\nvar list = ee.List([0, 1, 2, 3, 4]);\nprint('Original list', list);\n\n// If \"other\" argument is null, elements at positions specified by \"start\" and\n// \"count\" are deleted. Here, the 3rd element is removed.\nprint('Remove 1 element', list.splice({start: 2, count: 1, other: null}));\n\n// If \"start\" is negative, the position is from the end of the list.\nprint('Remove 2nd from last element', list.splice(-2, 1));\n\n// Deletes 3 elements starting at position 1.\nprint('Remove multiple sequential elements', list.splice(1, 3));\n\n// Insert elements from the \"other\" list without deleting existing elements\n// by specifying the insert \"start\" position and setting \"count\" to 0.\nprint('Insert new elements', list.splice(2, 0, ['X', 'Y', 'Z']));\n\n// Replace existing elements with those from the \"other\" list by specifying the\n// \"start\" position to replace and the \"count\" of proceeding elements. If\n// length of \"other\" list is greater than \"count\", the remaining \"other\"\n// elements are inserted, they do not replace existing elements.\nprint('Replace elements', list.splice(2, 3, ['X', 'Y', 'Z']));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# An ee.List object.\nee_list = ee.List([0, 1, 2, 3, 4])\nprint('Original list:', ee_list.getInfo())\n\n# If \"other\" argument is None, elements at positions specified by \"start\" and\n# \"count\" are deleted. Here, the 3rd element is removed.\nprint('Remove 1 element:',\n ee_list.splice(start=2, count=1, other=None).getInfo())\n\n# If \"start\" is negative, the position is from the end of the list.\nprint('Remove 2nd from last element:', ee_list.splice(-2, 1).getInfo())\n\n# Deletes 3 elements starting at position 1.\nprint('Remove multiple sequential elements:', ee_list.splice(1, 3).getInfo())\n\n# Insert elements from the \"other\" list without deleting existing elements\n# by specifying the insert \"start\" position and setting \"count\" to 0.\nprint('Insert new elements:', ee_list.splice(2, 0, ['X', 'Y', 'Z']).getInfo())\n\n# Replace existing elements with those from the \"other\" list by specifying the\n# \"start\" position to replace and the \"count\" of proceeding elements. If\n# length of \"other\" list is greater than \"count\", the remaining \"other\"\n# elements are inserted, they do not replace existing elements.\nprint('Replace elements:', ee_list.splice(2, 3, ['X', 'Y', 'Z']).getInfo())\n```"]]