ee.Dictionary.values

Trả về các giá trị của một từ điển dưới dạng danh sách. Nếu bạn không chỉ định khoá nào, thì tất cả các giá trị sẽ được trả về theo thứ tự tự nhiên của các khoá trong từ điển.

Cách sử dụngGiá trị trả về
Dictionary.values(keys)Danh sách
Đối sốLoạiThông tin chi tiết
this: dictionaryTừ điển
keysDanh sách, mặc định: null

Ví dụ

Trình soạn thảo mã (JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

print('Values for selected keys converted to ee.List',
      dict.values(['B1', 'B2']));
print('Values for all keys converted to ee.List', dict.values());

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

import ee
import geemap.core as geemap

Colab (Python)

# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
    'B1': 182,
    'B2': 219,
    'B3': 443
})

print('Values for selected keys converted to ee.List:',
      dic.values(['B1', 'B2']).getInfo())
print('Values for all keys converted to ee.List:', dic.values().getInfo())