TypeError: not all arguments converted during string formatting


#1

want to make some date calculator

coding=utf-8
import os, time, sys, fileinput, subprocess, datetime, os.path

Days = (time.strftime('%d'))
Months = (time.strftime('%m'))
Years = (time.strftime('%yy'))

if (Years%4 == 0):
Schaltjahr = 1
if (Years %100 == 0):
Schaltjahr = 0
if (years %400 == 0):
Schaltjahr = 1

Print( Schaltjahr )

-------------------My Problem-------------------------------------------------------------------------------------------------------

if i run this, i get following error code:

Traceback (most recent call last):
File "", line 6, in
TypeError: not all arguments converted during string formatting

thanks for watching it and your help

`


#2

@luminophore

import time
from datetime import datetime

Days = datetime.now().day
#Months = (time.strftime('%m'))
#Years = (time.strftime('%yy'))
print("{0} {1} {2}".format(Days,1,2))
#,Months,Years))

Please read
== the Book ==
https://docs.python.org/2.7/library/datetime.html?highlight=re
https://docs.python.org/2/c-api/datetime.html
== discussions / opinions ==
http://stackoverflow.com/questions/30071886/how-to-get-current-time-in-python-and-break-up-into-year-month-day-hour-minu


#3

well, thank you, fixxed it now :smile: ? !


#4

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