dictionary issue for formatted print

Yusuf Can Bayrak yusufcanbayrak at gmail.com
Fri Nov 7 17:04:19 EST 2014


when dictionary has one value for each key it's okey. I'm just type '%
greek_letters' and it's working.

But how can i assign dict's values to formatted print, if it has more
values than one.

>
>    1. # -*- coding: utf-8 -*-
>    2. greek_letters = {
>    3.                     'omega': ['ω','Ω'], 'psi': ['ψ', 'Ψ'] , 'kapa':
>    'κ', 'to': ['τ', 'Τ'], 'lambda': ['λ', 'Λ'],
>    4.                     'ksi': ['ξ', 'Ξ'], 'delta': ['δ', 'Δ'], 'mu':
>    ['μ'], 'sigma': ['σ', 'Σ'], 'epsilon': ['ε', 'Ε'],
>    5.                     'gamma': ['γ', 'Γ'], 'phi': ['φ', 'Φ'],
>    'theta': ['θ', 'Θ']
>    6.                 }
>    7. print 'x(%(to)s) = A * cos(%(omega)s * %(to)s + %(theta)s)' %
>    greek_letters.values()[1]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141108/3f2bc5e9/attachment.html>


More information about the Python-list mailing list