Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80414

dictionary issue for formatted print

Date 2014-11-08 00:04 +0200
Subject dictionary issue for formatted print
From Yusuf Can Bayrak <yusufcanbayrak@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15592.1415528662.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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]
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

dictionary issue for formatted print Yusuf Can Bayrak <yusufcanbayrak@gmail.com> - 2014-11-08 00:04 +0200

csiph-web