如何通过另一个词典获得dict值?

时间:2017-01-22 14:42:52

标签: python dictionary

我试图通过使用dict2来获取dict1值,但我收到错误消息

  

SyntaxError:语法无效

dict1 = {"1": "Ali","2": "21","3": "Kuwait"}
dict2 = {"Name": "1","Age": "2","City": "Kuwait"}
print(dict1['dict2['Name']'])

1 个答案:

答案 0 :(得分:2)

看起来你想要:import AVFoundation func stream() { let urlString = "http://google.com" let urlItem = URL(string: urlString) let avPlayerItem: AVPlayerItem? = AVPlayerItem(url: urlItem!) // ERROR: Cannot assign value of type 'AVPlayerItem' to type 'AVPlayerItem?.Type?' let avPlayer = AVPlayer(playerItem: avPlayerItem) // ERROR: Cannot convert value of type 'AVPlayerItem?.Type' (aka 'Optional<AVPlayerItem>.Type') to expected argument 'AVPlayerItem?' }

相关问题