【问题标题】:Find fields with empty strings查找具有空字符串的字段
【发布时间】:2021-02-18 15:41:14
【问题描述】:

我正在尝试查找带有空字符串的字段。它们看起来像这样:

Python 代码:

from loguru import logger
from google.cloud import firestore

firestore_client = firestore.Client.from_service_account_json('creds.json')
ref = firestore_client.collection('database')
users_ref = ref.collection(u'users').where(u'placeName', u'==', u'')
docs = [snapshot for snapshot in users_ref.stream()]

我的代码不起作用。我怎样才能得到这样的字段?

【问题讨论】:

标签: python google-cloud-firestore


【解决方案1】:

你可以使用如下条件语句:

if(<string> == ""):
    statement

这将在这些空字符串中执行您想要执行的语句

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-05
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多