0

私は次のことをしたい:

requestor = UrlRequestor("http://www.myurl.com/question?timestamp=", {'Content-Type': 'application/x-www-form-urlencoded', 'Cookie' : self.EASW_KEY + ";", 'X-UT-SID' :self.XUT_SID}, 'answer=' + self.securityHash)
requestor.open()
self.FUTPHISHING = requestor.getHeader('Set-Cookie').split(';')[0]

タイムスタンプの直後に、現地時間を次の形式で表示したいと思います:1355002344943

これどうやってするの?

4

2 に答える 2

1

timeモジュールからその形式で時刻を取得できます。具体的には、このようにします

import time

timeurl = "http://www.myurl.com/question?timestamp=%s" % time.time()
requestor = UrlRequestor(timeurl, {'Content-Type': 'application/x-www-form-urlencoded',      'Cookie' : self.EASW_KEY + ";", 'X-UT-SID' :self.XUT_SID}, 'answer=' + self.securityHash)
requestor.open()
self.FUTPHISHING = requestor.getHeader('Set-Cookie').split(';')[0]

time.time() は float を返すため、そのレベルの精度が気に入らない場合は、実行できます

timeurl = "http://www.myurl.com/question?timestamp=%s" % int(time.time())
于 2012-12-08T22:01:36.803 に答える