简体   繁体   中英

How to print the dictionary in this way in python

{1: ['Antil', '(AR,82)', '(BIO2,71)', '(DAPA,64)', '(EXC,43)', '(SLIP,40)'], 2: ['Josh', '(CCN,82)', '(COC,49)', '(IAML,72)'], 3: ['Andry', '(ES,98)', '(TTS,97)']}

Hi, this is the dictionary, how can i print it out in the following format in python, thanks very much

Antil-->(AR,82)(BIO2,71)(DAPA,64)(EXC,43)(SLIP,40)
Josh-->(CCN,82)(COC,49)(IAML,72)
Andry-->(ES,98)(TTS,97)
d = {1: ['Antil', '(AR,82)', '(BIO2,71)', '(DAPA,64)', '(EXC,43)', '(SLIP,40)'], 2: ['Josh', '(CCN,82)', '(COC,49)', '(IAML,72)'], 3: ['Andry', '(ES,98)', '(TTS,97)']}

for k,v in sorted(d.items()):
    print("{0}-->{1}".format(v[0],''.join(v[1:])))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM