ee.List.add
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Dodaje element na końcu listy.
Wykorzystanie | Zwroty |
---|
List.add(element) | Lista |
Argument | Typ | Szczegóły |
---|
to: list | Lista | |
element | Obiekt | |
Przykłady
Edytor kodu (JavaScript)
print(ee.List([]).add('b')); // ["b"]
print(ee.List(['a']).add('b')); // ["a","b"]
print(ee.List(['a']).add(ee.String('b'))); // ["a","b"]
print(ee.List(['a']).add(1)); // ["a",1]
print(ee.List(['a']).add(ee.Number(1))); // ["a",1]
print(ee.List(['a']).add(true)); // ["a",true]
print(ee.List(['a']).add([])); // ["a",[]]
print(ee.List(['a']).add(ee.List([]))); // ["a",[]]
print(ee.List(['a']).add(['b'])); // ["a",["b"]]
print(ee.List(['a']).add(ee.List(['b']))); // ["a",["b"]]
print(ee.List(['a']).add(ee.Dictionary())); // ["a",{}]
print(ee.List(['a']).add(ee.Dictionary({b: 'c'}))); // ["a",{"b":"c"}]
// 0: a
// 1: Image (1 band)
print(ee.List(['a']).add(ee.Image.constant(1)));
// ["a",{"type":"ImageCollection","bands":[]}]
print(ee.List(['a']).add(ee.ImageCollection([])));
Konfiguracja Pythona
Informacje o interfejsie Python API i używaniu geemap
do interaktywnego programowania znajdziesz na stronie
Środowisko Python.
import ee
import geemap.core as geemap
Colab (Python)
print(ee.List([]).add('b').getInfo()) # ['b']
print(ee.List(['a']).add('b').getInfo()) # ['a', 'b']
print(ee.List(['a']).add(ee.String('b')).getInfo()) # ['a', 'b']
print(ee.List(['a']).add(1).getInfo()) # ['a', 1]
print(ee.List(['a']).add(ee.Number(1)).getInfo()) # ['a', 1]
print(ee.List(['a']).add(True).getInfo()) # ['a', True]
print(ee.List(['a']).add([]).getInfo()) # ['a', []]
print(ee.List(['a']).add(ee.List([])).getInfo()) # ['a', []]
print(ee.List(['a']).add(['b']).getInfo()) # ['a', ['b']]
print(ee.List(['a']).add(ee.List(['b'])).getInfo()) # ['a', ['b']]
print(ee.List(['a']).add(ee.Dictionary()).getInfo()) # ['a', {}]
# ['a', {'b': 'c'}]
print(ee.List(['a']).add(ee.Dictionary({'b': 'c'})).getInfo())
# 0: a
# 1: Image (1 band)
print(ee.List(['a']).add(ee.Image.constant(1)).getInfo())
# ["a", {"type":"ImageCollection", "bands":[]}]
print(ee.List(['a']).add(ee.ImageCollection([])).getInfo())
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eList.add()\u003c/code\u003e appends an element to the end of a list and returns the modified list.\u003c/p\u003e\n"],["\u003cp\u003eThe method accepts any object as the element to be added.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eList.add()\u003c/code\u003e can be chained with other list methods for more complex operations.\u003c/p\u003e\n"],["\u003cp\u003eThe original list is not modified; a new list with the added element is returned.\u003c/p\u003e\n"]]],["The `List.add(element)` function appends an element to the end of a list. It takes an object as an argument (`element`), which can be any data type. The function modifies the list by adding the provided element at the end. It returns the modified list. The examples show different elements added to a list, including strings, numbers, booleans, empty lists, and even more complex data structures like dictionaries, images, and image collections.\n"],null,["# ee.List.add\n\nAppends the element to the end of list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------|---------|\n| List.add`(element)` | List |\n\n| Argument | Type | Details |\n|--------------|--------|---------|\n| this: `list` | List | |\n| `element` | Object | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(ee.List([]).add('b')); // [\"b\"]\nprint(ee.List(['a']).add('b')); // [\"a\",\"b\"]\nprint(ee.List(['a']).add(ee.String('b'))); // [\"a\",\"b\"]\n\nprint(ee.List(['a']).add(1)); // [\"a\",1]\nprint(ee.List(['a']).add(ee.Number(1))); // [\"a\",1]\n\nprint(ee.List(['a']).add(true)); // [\"a\",true]\n\nprint(ee.List(['a']).add([])); // [\"a\",[]]\nprint(ee.List(['a']).add(ee.List([]))); // [\"a\",[]]\nprint(ee.List(['a']).add(['b'])); // [\"a\",[\"b\"]]\nprint(ee.List(['a']).add(ee.List(['b']))); // [\"a\",[\"b\"]]\n\nprint(ee.List(['a']).add(ee.Dictionary())); // [\"a\",{}]\nprint(ee.List(['a']).add(ee.Dictionary({b: 'c'}))); // [\"a\",{\"b\":\"c\"}]\n\n// 0: a\n// 1: Image (1 band)\nprint(ee.List(['a']).add(ee.Image.constant(1)));\n\n// [\"a\",{\"type\":\"ImageCollection\",\"bands\":[]}]\nprint(ee.List(['a']).add(ee.ImageCollection([])));\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\nprint(ee.List([]).add('b').getInfo()) # ['b']\nprint(ee.List(['a']).add('b').getInfo()) # ['a', 'b']\nprint(ee.List(['a']).add(ee.String('b')).getInfo()) # ['a', 'b']\n\nprint(ee.List(['a']).add(1).getInfo()) # ['a', 1]\nprint(ee.List(['a']).add(ee.Number(1)).getInfo()) # ['a', 1]\n\nprint(ee.List(['a']).add(True).getInfo()) # ['a', True]\n\nprint(ee.List(['a']).add([]).getInfo()) # ['a', []]\nprint(ee.List(['a']).add(ee.List([])).getInfo()) # ['a', []]\nprint(ee.List(['a']).add(['b']).getInfo()) # ['a', ['b']]\nprint(ee.List(['a']).add(ee.List(['b'])).getInfo()) # ['a', ['b']]\n\nprint(ee.List(['a']).add(ee.Dictionary()).getInfo()) # ['a', {}]\n\n# ['a', {'b': 'c'}]\nprint(ee.List(['a']).add(ee.Dictionary({'b': 'c'})).getInfo())\n\n# 0: a\n# 1: Image (1 band)\nprint(ee.List(['a']).add(ee.Image.constant(1)).getInfo())\n\n# [\"a\", {\"type\":\"ImageCollection\", \"bands\":[]}]\nprint(ee.List(['a']).add(ee.ImageCollection([])).getInfo())\n```"]]