ee.List.splice
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
با شروع از فهرست شروع، عناصر تعداد را از لیست حذف می کند و محتویات دیگر را در آن مکان درج می کند. اگر شروع منفی باشد، از انتهای لیست به عقب شمارش می شود.
| استفاده | برمی گرداند | List. splice (start, count, other ) | فهرست کنید |
| استدلال | تایپ کنید | جزئیات | این: list | فهرست کنید | |
start | عدد صحیح | |
count | عدد صحیح | |
other | لیست، پیش فرض: null | |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
// 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'])); راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
# An ee.List object.
ee_list = ee.List([0, 1, 2, 3, 4])
display('Original list:', ee_list)
# If "other" argument is None, elements at positions specified by "start" and
# "count" are deleted. Here, the 3rd element is removed.
display('Remove 1 element:',
ee_list.splice(start=2, count=1, other=None))
# If "start" is negative, the position is from the end of the list.
display('Remove 2nd from last element:', ee_list.splice(-2, 1))
# Deletes 3 elements starting at position 1.
display('Remove multiple sequential elements:', ee_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.
display('Insert new elements:', ee_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.
display('Replace elements:', ee_list.splice(2, 3, ['X', 'Y', 'Z']))
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-10-30 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-10-30 بهوقت ساعت هماهنگ جهانی."],[],[]]