不能随便用get和set

有些对象呢,保存一半。如果你只提供get和set,那么备份不了数据。

previousState的get和set还是最新的

 

 

wtforms

InputRequired:

DataRequired: if not 来check的,转了一下类型

https://www.zhihu.com/question/49854915

 

 

 

import requests
response = requests.get('', params=None)
result = response.text


print(bytes(result, encoding='utf-8'))
region = Region()
region.ParseFromString(bytes(result, encoding='utf-8'))
print(region)
放回的是bytestring

 

 

import requests
response = requests.get('http://localhost:4000/vc/config-management/region', params=None)
result = response.json()

# import json
# result = json.loads(result)
hello = json_format.Parse(result[0], Region(), ignore_unknown_fields=False)
print(hello.name)
放回的是json_format

 

 

 

1、a || [] 不是一个好的做法,要知道a可能是0,就会有bug

2、python中,遍历一个list,可能是None就不方便遍历,不需要特判,可以使用 for value in list or []

posted on 2019-05-06 15:56  stupid_one  阅读(256)  评论(0编辑  收藏  举报

导航