Django中如何实现嵌套try-except结构来处理异常?
- 内容介绍
- 文章标签
- 相关推荐
本文共计955个文字,预计阅读时间需要4分钟。
我尽量简洁地改写以下内容,不超过100字:
我就不多说了,大家还是直接看代码吧!
我就废话不多说了,大家还是直接看代码吧!
# 因为此时为yaml模板,而且只抓取node port,所以这样处理效率快 content_dict = parse_yaml(content.replace("{{", "").replace("}}", "")) if 'service' in content_dict.keys(): # 记录本次yaml里所有的node_port,并更新到数据库 now_app_list = [] for service_item in content_dict['service']: for port_item in service_item['port']: if 'nodePort' in port_item.keys(): node_port = int(port_item['nodePort']) if 30000 <= node_port <= 32000: # 这里判断比较复杂,如果端口有,而且app相同,不更新。如果端口有,app不一样,报冲突。如果端口没有,可插入。
本文共计955个文字,预计阅读时间需要4分钟。
我尽量简洁地改写以下内容,不超过100字:
我就不多说了,大家还是直接看代码吧!
我就废话不多说了,大家还是直接看代码吧!
# 因为此时为yaml模板,而且只抓取node port,所以这样处理效率快 content_dict = parse_yaml(content.replace("{{", "").replace("}}", "")) if 'service' in content_dict.keys(): # 记录本次yaml里所有的node_port,并更新到数据库 now_app_list = [] for service_item in content_dict['service']: for port_item in service_item['port']: if 'nodePort' in port_item.keys(): node_port = int(port_item['nodePort']) if 30000 <= node_port <= 32000: # 这里判断比较复杂,如果端口有,而且app相同,不更新。如果端口有,app不一样,报冲突。如果端口没有,可插入。

