Now I got some problem that I can't explain and fix.
This is my first python module
TimeHelper.py
from datetime import datetime
def fun1(currentTime = datetime.now()):
print(currentTime)
and another is
Main.py
from TimeHelper import fun1
import time
fun1()
time.sleep(5)
fun1()
When I run the Main.py, the out put is
2020-06-16 09:17:52.316714
2020-06-16 09:17:52.316714
My problem is why the time will be same in the result ? Is there any restrict when passing datetime.now() in to default parameter ?
None
, and assign a value if the argument isNone
(eg. not specified).