楼主:
sssh (叫我松高魂 ~~)
2018-11-06 12:30:26各位前辈们,
小弟现在正在coursera自学python
课程中有一个题目是:
"Change either the www.py4e.com/code3/geojson.py or
www.py4e.com/code3/geoxml.py to print oout the two-character country code from
the retrieved data. Add error checking so you program does not traceback if
the country code is not there. Once you have it working, search for "Atlantic
Ocean" and make sure it can handle locations that are not in any country."
我把网址里面给的语法贴出来
https://imgur.com/DqgrET7
他应该要我们改写成
print出城市的缩写,并且利用try except 语法来避免没有缩写而跳出traceback
我可以改写到把有缩写的从formatted_address找出来,
但是如果没有缩写的我就不知道怎么处理=.=a
想请问大家这个部分应该怎么处理比较好?
PS:我自学没有付费,所以这不是强制要交的作业,我不是来要答案的XDDDD
我只是单纯想知道这应该怎么做比较好,麻烦大家指点指点啊~~~~