Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80430
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '-*-': 0.07; 'assign': 0.07; 'utf-8': 0.07; 'coding:': 0.09; 'keys,': 0.09; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'works.': 0.09; 'wrote': 0.14; "'lambda':": 0.16; 'formatted': 0.16; 'larger,': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'subject:issue': 0.16; 'working.': 0.19; '(the': 0.22; 'separate': 0.22; 'decide': 0.24; 'values': 0.27; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; "i'm": 0.30; 'code': 0.31; '(usually': 0.31; 'figure': 0.32; 'but': 0.35; 'doing': 0.36; 'two': 0.37; 'starting': 0.37; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'expression': 0.60; "you'll": 0.62; 'more': 0.64; 'yusuf': 0.84; 'subject::': 0.85 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re:dictionary issue for formatted print |
| Date | Sun, 9 Nov 2014 08:41:41 -0500 (EST) |
| Organization | news.gmane.org |
| References | <CAEi_QX=X_pRmD1Zvy1Gqvo4+Wjj_fkqZSY5Vc06SggOzDmeJDQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | 97.73.240.77 |
| X-Newsreader | PiaoHong.Usenet.Client.VIP:1.64 |
| X-Archive | encrypt |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15598.1415540514.18130.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1415540514 news.xs4all.nl 2953 [2001:888:2000:d::a6]:46772 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:80430 |
Show key headers only | View raw
Yusuf Can Bayrak <yusufcanbayrak@gmail.com> Wrote in message:
> 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. # -*- coding: utf-8 -*-greek_letters = { 'omega': ['ω','Ω'], 'psi': ['ψ', 'Ψ'] , 'kapa': 'κ', 'to': ['τ', 'Τ'], 'lambda': ['λ', 'Λ'], 'ksi': ['ξ', 'Ξ'], 'delta': ['δ', 'Δ'], 'mu': ['μ'], 'sigma': ['σ', 'Σ'], 'epsilon': ['ε', 'Ε'], 'gamma': ['γ', 'Γ'], 'phi': ['φ', 'Φ'], 'theta': ['θ', 'Θ'] }print 'x(%(to)s) = A * cos(%(omega)s * %(to)s + %(theta)s)' % greek_letters.values()[1]
>
How do you intend for the logic to choose? You need to decide the
logic (usually by doing it by hand) before you can figure out
how to code it.
My assumption is that you want the expression to decide (the
thing starting "A *"
). So you'll need to have two separate keys,
like omega and Omega. The dictionary gets a little larger, and
it just works.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re:dictionary issue for formatted print Dave Angel <davea@davea.name> - 2014-11-09 08:41 -0500
csiph-web