Hi
A few months ago, I started learning Python - my first language for a
project I want to do (personal) which will involve several facets
including MySql/postgres database and gui frontend I need to create on
windows xp. So I started this in python and I use Eric 4 ide.
At the time I had no knowledge and tossed up between Ruby and Python,
I chose python because I thought it had been around longer so may be
more mature.
So why Ruby now, well honestly my 3rd daughter has been born two days
ago Ruby Jean, why would I program Python when my daughter is Ruby?
My question would Eric4 still be a good choice for Ide in Ruby, code
completion, highlighting(syntax) and debugging would be required in
IDE.
Secondly I found capturing the date input from a console in python to
be a little long winded, below is the script I wrote in python would
this be significantly easier in Ruby.
Which version of Ruby should I use 1.8.6, 1.9.1 or a preview version
of 1.9.2?
My python script to capture date input and check for errors.
import datetime as dt
def ObtainDate():
isValid=False
while not isValid:
userIn = raw_input("Type Date dd/mm/yy: ")
try: # strptime throws an exception if the input doesn’t match
the pattern
d1 = dt.datetime.strptime(userIn, “%d/%m/%y”)
isValid=True
print d1, type(d1) # 2003-07-15 00:00:00 <type
‘datetime.datetime’>
“convert datetime object to a 10 character string”
d2 = str(d1)[:10]
print d2, type(d2) # 2003-07-15 <type ‘str’>
except:
print “Try again! dd/mm/yy\n”
Fname = “data.dat”
newFname = d2 + Fname
return newFname
print ObtainDate()