我想讀取一個YAML文件並按照它在文件中的順序打印出列表中的列表。 所以YAML: b: ...
a: ...
我的蟒蛇是: for key, value in yaml.load(open(input_file)).items():
print(str(key))
輸出變爲: a
b
但是我需要它是b然後a。我也試過iteritems(),我得到了同樣的結果。
問題:運行下面的代碼時出現錯誤。我是新手,不確定如何解決問題。 creae功能將每個座標點分配給它的區域。 def find_borough(lat,lon):
"""
return the borough of a location given its latitude and longitude
lat: float, latitude
lon:
我寫一段代碼,通過每個記錄迭代並打印統計稱爲間隔。 for record in records:
from collections import Counter
count = Counter(intervals)
for interval, frequency in count.iteritems():
print interval
pr