Home > other >  New small white please advise - a python from others brought the use of the return lag time and date
New small white please advise - a python from others brought the use of the return lag time and date

Time:10-02

The code is as follows:
From the time the import time
Import a datetime
Time0=time ()
Print (datetime. Datetime. Fromtimestamp (time () - time0). The strftime (" % M: % S: % f "))

An error is as follows:
OSError Traceback (the most recent call last)
()
2 the import datetime
3 time0=time ()
- & gt; 4 the print (datetime. Datetime. Fromtimestamp (time () - time0). The strftime (" % M: % S: % f "))

OSError: [22] Errno Invalid argument

CodePudding user response:

You use python 3. X environment to run, may be a version issue,

CodePudding user response:

Python3 environment code no problem, you check your environment,

CodePudding user response:

refer to the second floor ruancan response:
python3 environment code no problem, you check your environment,


Is to use jupyter notebook run, help () checked is python3.6, don't know what you said check wipe clean environment refers to how to check

CodePudding user response:

Operating system environment is different, so the function parameter is illegal, you check a datetime API documentation

CodePudding user response:

Will fromtimestamp utcfromtimestamp instead
  • Related