拥有一个ParseObject对象,我如何遍历其字段并获取字段的名称及其值?这确实可以帮助我最小化代码。
答案 0 :(得分:1)
嗯,ParseObject包含键值对,我认为你不能迭代它。但。我找到了一个名为ParseObject的def description(infilepath, startblock, endblock, word, startdesc, enddesc):
with open(infilepath) as infile:
inblock = False
name = None
found = False
answer = []
for line in infile:
if found and not inblock: return answer
if line.strip() != startblock and not inblock: continue
if line.strip() == startblock: inblock = True
elif line.strip() == endblock: inblock = False
if not line.startswith(startdesc):
name = line.strip()
continue
if name is not None and name != word: continue
if not line.startswith(startdesc): continue
answer.append(line.strip().lstrip(startdesc).rstrip(enddesc))
方法。它返回......好吧,键组(不包括createdAt,updatedAt,authData或objectId)。我想你可以把它转换成一个数组并迭代它吗?
这样的事情:
.keySet()