Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Print a dictionary only keys without brackets and quotation marks

myDict = {"1" : "Gorilla", "2" : "Place", "3" : "Place to learn"}

So, I want to print out a dictionary. But I want to do it like it looks like an actual list of things. I can’t just do print myDict, as it will leave all the ugly stuff in. I want the output to look like

> 1234

So what do I do? I haven’t found a post meeting what I want. Thanks in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

print("".join(myDict.keys())
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading