From datetime import datetime now = datetime.now() print '%s/%s/%s %s:%s:%s' % (now.month, now.date, now.year, now.hour, now.minute, now.second). this is my code but it showing error I need help


#1



Replace this line with your code.


#2

And what exactly is your question?


#3

hello ,exactly i got the wrong one. All you can do is to code in a different way.follow this,,,

date = '%s/%s/%s' %(now.month,now.day,now.year)
time = '%s:%s:%s' %(now.hour,now.minute,now.second)
print(date+ " "+time)


#4

hi
i was getting the same issue but finally managed it...
your code is almost right... just put a space between 3rd and 4th %s
try this...
hope it works
cheers.........


#5

try using
print "date is %s/%s/%s and time is%s:%s:%s %(now.day,now.month,now.year,now.hour,now.minute,now.second)


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.