S
Stano Paska
Hi.
I need pass variables to function like tuple, but function accepts
separate variables.
Is there some elegant solution?
My example:
# -------------------------------
import datetime
def date2tuple(aaa):
try:
y = int(aaa[:4])
m = int(aaa[5:7])
d = int(aaa[8:10])
except:
y = m = d = 0
return (y, m, d)
# i need some like this
bbb = datetime.date(date2tuple('2004-11-03'))
# but date requires
bbb = datetime.date(2004, 11, 03)
# -------------------------------
Thanks.
Stano Paska
I need pass variables to function like tuple, but function accepts
separate variables.
Is there some elegant solution?
My example:
# -------------------------------
import datetime
def date2tuple(aaa):
try:
y = int(aaa[:4])
m = int(aaa[5:7])
d = int(aaa[8:10])
except:
y = m = d = 0
return (y, m, d)
# i need some like this
bbb = datetime.date(date2tuple('2004-11-03'))
# but date requires
bbb = datetime.date(2004, 11, 03)
# -------------------------------
Thanks.
Stano Paska