Articles
|
News
|
Weblogs
|
Books
|
Forums
Artima Forums
|
Articles
|
Weblogs
|
Java Answers
|
News
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
Back to Topic List
Reply to this Topic
Search Forum
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
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
]
Previous Topic
Next Topic
Sponsored Links
Web
Artima.com
Copyright
© 1996-2019 Artima, Inc. All Rights Reserved. -
Privacy Policy
-
Terms of Use