print
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
In các đối số ra bảng điều khiển.
Cách sử dụng | Giá trị trả về |
---|
print(var_args) | |
Đối số | Loại | Thông tin chi tiết |
---|
var_args | VarArgs<Object> | Các đối tượng cần in. |
Ví dụ
Trình soạn thảo mã (JavaScript)
print(1); // 1
print(ee.Number(1)); // 1
print(ee.Array([1])); // [1]
print(ee.ImageCollection('AAFC/ACI').size()); // 10
print(ee.Image('AAFC/ACI/2009')); // Image AAFC/ACI/2009 (1 band)
print(ee.FeatureCollection("NOAA/NHC/HURDAT2/pacific").size()); // 28547
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)
"""There is no dedicated print function for the Earth Engine Python API.
To print Earth Engine objects, use Python's built-in `print` function.
Printing an Earth Engine object in Python prints the serialized request for the
object, not the object itself, so you must call `getInfo()` on Earth Engine
objects to get the desired object from the server to the client. For example,
`print(ee.Number(1).getInfo())`. Note that `getInfo()` is a synchronous
operation. Alternatively, the eerepr library provides rich Earth Engine object
representation; it is included in the geemap library.
"""
print(1) # 1
print(ee.Number(1).getInfo()) # 1
print(ee.Array([1]).getInfo()) # [1]
print(ee.ImageCollection('AAFC/ACI').size().getInfo()) # 10
print(ee.Image('AAFC/ACI/2009').getInfo()) # Image AAFC/ACI/2009 (1 band)
print(
ee.FeatureCollection("NOAA/NHC/HURDAT2/pacific").size().getInfo()
) # 28547
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eprint()\u003c/code\u003e displays the provided arguments, including Earth Engine objects and standard data types, in the console.\u003c/p\u003e\n"],["\u003cp\u003eIn JavaScript, \u003ccode\u003eprint()\u003c/code\u003e directly displays Earth Engine objects, while in Python, you typically need to use \u003ccode\u003egetInfo()\u003c/code\u003e or the \u003ccode\u003eeerepr\u003c/code\u003e library for proper visualization.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts a variable number of arguments (\u003ccode\u003evar_args\u003c/code\u003e) representing the objects to be printed.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided demonstrating the usage of \u003ccode\u003eprint()\u003c/code\u003e with various Earth Engine objects like \u003ccode\u003eee.Number\u003c/code\u003e, \u003ccode\u003eee.Array\u003c/code\u003e, \u003ccode\u003eee.ImageCollection\u003c/code\u003e, and \u003ccode\u003eee.Image\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `print` function displays objects to the console. It accepts `VarArgs` as input. In JavaScript, `print(var_args)` directly outputs the object's value. In Python, the built-in `print` displays the serialized request for Earth Engine objects. To print the object's value in Python, `.getInfo()` is needed, which synchronously retrieves the object from the server, as in `print(ee.Number(1).getInfo())`. Example cases are shown for numbers, arrays, and image collections.\n"],null,["# print\n\n\u003cbr /\u003e\n\nPrints the arguments to the console.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------|---------|\n| `print(var_args)` | |\n\n| Argument | Type | Details |\n|------------|-------------------|-----------------------|\n| `var_args` | VarArgs\\\u003cObject\\\u003e | The objects to print. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(1); // 1\nprint(ee.Number(1)); // 1\nprint(ee.Array([1])); // [1]\n\nprint(ee.ImageCollection('AAFC/ACI').size()); // 10\nprint(ee.Image('AAFC/ACI/2009')); // Image AAFC/ACI/2009 (1 band)\n\nprint(ee.FeatureCollection(\"NOAA/NHC/HURDAT2/pacific\").size()); // 28547\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\"\"\"There is no dedicated print function for the Earth Engine Python API.\nTo print Earth Engine objects, use Python's built-in `print` function.\nPrinting an Earth Engine object in Python prints the serialized request for the\nobject, not the object itself, so you must call `getInfo()` on Earth Engine\nobjects to get the desired object from the server to the client. For example,\n`print(ee.Number(1).getInfo())`. Note that `getInfo()` is a synchronous\noperation. Alternatively, the eerepr library provides rich Earth Engine object\nrepresentation; it is included in the geemap library.\n\"\"\"\n\nprint(1) # 1\nprint(ee.Number(1).getInfo()) # 1\nprint(ee.Array([1]).getInfo()) # [1]\n\nprint(ee.ImageCollection('AAFC/ACI').size().getInfo()) # 10\nprint(ee.Image('AAFC/ACI/2009').getInfo()) # Image AAFC/ACI/2009 (1 band)\n\nprint(\n ee.FeatureCollection(\"NOAA/NHC/HURDAT2/pacific\").size().getInfo()\n) # 28547\n```"]]