python - 使用 python 的 Firestore 中的 GeoPoint

标签 python python-3.x firebase google-cloud-firestore

我正在尝试使用 Python 将 GeoPoint 保存在我的 Firebase Firestore 中,但没有成功。 这给我语法错误:

location=new firebase.firestore.GeoPoint(latitude, longitude)

有什么解决办法吗?也许我缺少要导入的东西,但我找不到什么。提前致谢。

最佳答案

你可以使用

from google.cloud.firestore import GeoPoint

# Just example values so the code runs.
latitude = 0.0
longitude = 0.0
location = GeoPoint(latitude, longitude)

print(location)

new 不是 python 关键字,不需要使用。

关于python - 使用 python 的 Firestore 中的 GeoPoint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52497454/

相关文章:

python-3.x - ast 节点不保留某些属性(lineno 或/和 col_offset)

php - 火力基地: "Could not parse auth token."

多次调用Android firebase auth状态监听器

java - firestore回调方法是否在单独的线程中运行?

python - 如何使用全局变量的值来确定在单独线程中运行的函数的控制流?

python-3.x - 找不到 Jinja 嵌套模板

python - 在 Python 中从空格分隔的 key=value 字符串创建字典

python-3.x - 谷歌云 python 项目有本地主机错误

python - 无法读取 Visual FoxPro DBF 文件中的编码文本

python - 如何退出 python execfile() 而不退出整个脚本