For example, I want to print only keys that contain 'a' characters in the dictionary named 'dics = { 'abdc' : 1234, 'abbbd' : 1244, 'adffbg' : 1255, 'bbbffgrg' = 1666}. How do I print them?
python dictionary
>>> d = { 'abdc' : 1234, 'abbbd' : 1244, 'adffbg' : 1255, 'bbffgrg' : 1666}
>>> d.keys()
dict_keys(['abdc', 'abbbd', 'adffbg', 'bbffgrg'])
>>> [ k for k in d.keys() if 'a' in k ]
['abdc', 'abbbd', 'adffbg']
573 PHP ssh2_scp_send fails to send files as intended
593 Uncaught (inpromise) Error on Electron: An object could not be cloned
592 GDB gets version error when attempting to debug with the Presense SDK (IDE)
565 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
566 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.