我希望能够使用 Python s strptime
在 9: 00p
等时间使用 Python s s
, 即
p
代表 PM 。
看来我最接近的赌注是
http://docs.python.org/library/time.html#time.strftime
问题是,它只处理 pm
或 PM
。 我要它接受 p
。
文件上说它使用“当地人相当于AM或PM” 。 有没有办法让我将“当地人相当于”改为p
和a
?
我希望能够使用 Python s strptime
在 9: 00p
等时间使用 Python s s
, 即
p
代表 PM 。
看来我最接近的赌注是
http://docs.python.org/library/time.html#time.strftime
问题是,它只处理 pm
或 PM
。 我要它接受 p
。
文件上说它使用“当地人相当于AM或PM” 。 有没有办法让我将“当地人相当于”改为p
和a
?
不幸的是, Windows 中的短时和长时格式仅支持 A. M. 或 P. M. 的 < code> < /code >, 似乎无法改变这一点 。
您不能预处理字符串并使用 . replace (p, pm). replace (a, am)
吗?
问题是,当您可能认为它是一种方便功能时,您想要 strptime
来分析一切。 更改“ 本地等效” 是制作神秘代码并用其它东西( 如 strftime
) 解密的好方法 。
您最好在字符串 first 中将 9: 00p
替换为 9: 00p
。 您可能想要在替换中检查合理性, 例如“ Thursp” 不应该成为“ Thurspm ” 。
您 能够 em> 预处理它。 您 能够 em > 更改对齐核心的代码 。
最坏的情况是,您可以使用亚类,甚至猴子类。如果你决定显示一些代码,我们很乐意指出前进的方向。
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...
Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...
Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...
I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...
I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...