{} from dict suppressing - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: {} from dict suppressing (/thread-22375.html) |
{} from dict suppressing - Adem - Nov-10-2019 Hi, little issue. Could u please tell me how to remove the {} between each number and "0" in the output of the console ? Thanks! def fonction2_bis(n,a,b): import random r= random.randint(a,b) L=[] L2=[] for i in range(n): r= random.randint(a,b) L.append(r) for item in L: dict={str(item): "\""+str(0) +"\""} L2.append(dict) print("There are",(len(L)), "items") return L2 >>> fonction2_bis(5,1,2) There are 5 items [{'2': '"0"'}, {'2': '"0"'}, {'2': '"0"'}, {'2': '"0"'}, {'1': '"0"'}] RE: {} from dict suppressing - Larz60+ - Nov-11-2019 you created dictionaries in step 10. I would think you'd want to show them. show what you want to see in the output RE: {} from dict suppressing - micseydel - Nov-15-2019 (Nov-11-2019, 12:02 AM)Larz60+ Wrote: show what you want to see in the outputJust reiterating this point, because we'd genuinely like to help! |