The Artima Developer Community
Sponsored Link

Weblogs Forum
The Adventures of a Pythonista in Rubyland/2 - No Comprehension

30 replies on 3 pages. Most recent reply: Jan 4, 2009 7:26 PM by Carl Graff

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 30 replies on 3 pages [ « | 1 2 3 ]
Carl Graff

Posts: 2
Nickname: cgramona
Registered: Jan, 2009

Re: The Adventures of a Pythonista in Rubyland/2 - No Comprehension Posted: Jan 4, 2009 7:26 PM
Reply to this message Reply
Advertisement
One other thing I miss is the print formatting. Any know how to do these two lines is in Python?

usrs = [{:name=>'John',:tmpCnv=>'tmp*(9/5)+32'},{:name=>'Emma',:tmpCnv=>'t mp'}]

[0,50].each{|tmp| usrs.each{|usr| puts "#{Time.now} #{usr[:name]} it's #{eval(usr[:tmpConv])} #{tmp==0?'Freeze':'Other'}"}}

Output is:
Sun Jan 04 19:24:53 2009 John it's 32 Freeze
Sun Jan 04 19:24:53 2009 Emma it's 0 Freeze
Sun Jan 04 19:24:53 2009 John it's 82 Other
Sun Jan 04 19:24:53 2009 Emma it's 50 Other

Flat View: This topic has 30 replies on 3 pages [ « | 1  2  3 ]
Topic: The decorator module version 3 is out! Previous Topic   Next Topic Topic: Ubuntu on the EeePC

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use