Q:

datetime strftime %s crash on windows

I have this piece of code that fails on windows, but works on linux:
import datetime as dt

ts = dt.datetime.now().__format__('%s')
#ts == '1479831118'

I look into the documentation (Python 3.5) and 'format %s' don't even exist there.
How can I fix this and get the same output from Linux ?
Thanks

A:

The code you've provided outputs current time in seconds.
I may recommend to use time module.
This will return the same.
import time
ts = str(int(time.time()))

