I have a simple time.py file:
import datetime
import time
import re
def cnvrt1(time):
hr = int(re.split(":",time)[0])
min = int(re.split(":",time)[1])
sec = int(re.split(" ",re.split(':',time)[2])[0])
ampm = re.split(" ",re.split(':',time)[2])[1][0]
zone = re.split(" ",re.split(':',time)[2])[2][0]
if ampm == 'P' && hr < 12 :
hr = hr + 12
elif ampm == 'A' && hr == 12 :
hr = hr - 12;
dt = datetime.datetime.strptime(year=2013,month=10,day=22,hour=hr,minute=min,second=sec)
res1 = time.mktime(dt.timetuple())
if zone =='M':
res1 = res1 - 3600000;
if zone =='C' :
res1 = res1 - 3600000*2;
if zone == 'E' :
res1 = res1 - 3600000*3;
return res1
However when I say from time import cnvrt1, it says ImportError: can't import name 'cnvrt1'. Can anyone point me to what I might be doing wrong?