python dictionary formatted printout -
I am trying to print a keyboard for each key in a formatted way, where the key is separated Just the plane text is indented without the values and any brackets or comos, eg:
--- My bookmark manager ---
Number __________ name _________________ address
1 __________ instead of Google Scholar ______________ Website 1
:
--- My bookmark manager ---
No. ___________ Name _________________ Address
_ _
1 ('Google Scholar', 'Website 1')
Here is my code:
web_pages = {1: ('Google Scholar', 'Website 1'), 2: ('Moodle', 'Website2'), 3 :( 'BBC', 'Website 3') , 4 :( 'webmail', 'website4')} ## - ------ Product_structure_top -------------------------- - def output_structure_top (): print "--- my bookmark manager ---" + "\ n" print "number" + "" * 10 + "name" + "" 30 + "address \ n" print " "* 60 +" \ n "## ---- Output_Start_bottom ----------------------- - def output_structure_bottom (): Print" - "* 60 + "\ N" ## ---- --------------------------- to key -------------------- Value in output_structure_top (), web_pages.iteritems (): print key, value_with_structure_bottom ()
web_pages = {1 :( 'Google Scholar', 'Website1'), 2: ('Moodle', 'Website2'), 3 :( 'BBC', 'Website 3'), 4 :( 'webmail', 'website4')} ## ------- output_stroct_top ---------- ----------------- def Output_structure_top (): print "--- my bookmark manager ---" \ n "print" number "+" "10 +" name "+" "30 +" address \ n "print" - "* 60 + "\ N" ## ---- Product_stroke_bottom -------------- ----- ----- def output_structure_bottom (): Print "-" * 60 + "\ n" ## ---------------------- ----- ------------------------- def output_structure_value (key, value): print (str (key) + "* 10 + value Value for output_structure_value (key, value) output_structure_bottom ()
Comments
Post a Comment