Jump to content
Korean Random

Кто из нас дебил: я или картошка? ;-)


ShuraBB

Recommended Posts

print datetime.datetime.strptime('Mon Feb 01 21:13:30 2016', '%a %b %d %H:%M:%S %Y')

 

В клиенте WoT получаем:

ERROR: File "scripts/common/Lib/_strptime.py", line 325, in _strptime

ERROR: ValueError: time data 'Mon Feb 01 21:13:30 2016' does not match format '%a %b %d %H:%M:%S %Y'

 

В "родном питоне" получаем логичное "2016-02-01 21:13:30"

.....

Link to comment
Short link
Share on other sites

datetime.strptime это обратная к strftime - дата из текстовой строки

 

Задачка-то была простая: Из даты в формате time.time() с произвольным смещением в днях получить чистую дату. Решение тоже не сложное:

 

import time, datetime

Time = time.time()

Delta = 12

print datetime.date.fromtimestamp(Time) + datetime.timedelta(days=Delta)

 

Но факт остается фактом: datetime.datetime.strptime в клиенте не работает

Edited by ShuraBB
Link to comment
Short link
Share on other sites

>а в русской локализации даты?

Не проверял. Собственно изначально было так: datetime.datetime.strptime(time.ctime(Time), '%a %b %d %H:%M:%S %Y')

time.ctime(Time) выдает в английской ;-)

Link to comment
Short link
Share on other sites

Есть еще один момент... Попробуйте на питоне (чисто питоне) c помощью urllib скачать файл с FTP. А потом на клиенте игры. Та же самая херня. Короче, у картохи весьма кривые либы стоят, возможно просто очень старые или правленые кривыми руками картохиных индусов. Но их это не парит. Страдайте, ребят)

Если конечно либа чисто питоновская, ее еще можно подкинуть, а вот если C... Тогда только обходными путями решать задачу.

Link to comment
Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...