//创建一个空字典:key:int,value:string
var nameOfintegers = [Int:String]();
//字面量创建
var airports:[String:String] = ["yyz":"tiribtciyb","zzy":"dddd"];
//访问和修改字典
//自定键值队数量
print(airports.count);
//使用是否为空isEmpty;
//添加一个键值队
airports["aaa"] = "Kibdib";
//根据键值队来改变特定值
airports["LHR"] = "london heathrow";
//遍历
for (airportcode,airportName) in airports {
print("\(airportcode):\(airportName)");
}
//通过keys或者values属性
for airporcode in airports.keys {
print("airport code:\(airporcode)");
}
//通过value获取属性
for airportcode in airports.keys {
print("aipotr code:\(airportcode)");
}
//获取键值对
//获取键
let airportCodes = [String](airports.keys)
//获取值
let airportNames = [String](airports.values)