所以我有以下字符串:“01 一月 2016” 为 UTC ISO 日期格式?
我正在使用箭头模块和以下代码,但它充满了错误,我想可能有一个更小更优雅的解决方案,因为 python 鼓励优雅和更简单的方法来做事,无论如何,这是我的代码:
updateStr = " 01 January 2016" #Note the space at the beginning
dateList = updateStr.split[' ']
dateDict = {"day" : dateList[1],"month": months.index(dateList[2])+1, "year" : dateList[3]}
dateStr = str(dateDict['day']) + "-" + str(dateDict["month"]) + "-" + str(dateDict["year"])
dateISO = arrow.get(dateStr, 'YYYY-MM-DD HH:mm:ss')
Run Code Online (Sandbox Code Playgroud)
请帮助我,我必须将其转换为 UTC ISO 格式,月份也是一年中月份的列表。
所以我刚刚开始学习 lua ,我正在 Corona SDK 中为我的游戏编写一个小脚本,但脚本的部分是纯 lua 。
这是一些代码:
function checkNumAndExp(number)
local correct;
if randomText == "bigger than " then
if number > randomNumber then
correct = true;
end
return correct;
elseif randomText == "smaller than " then
if number < randomNumber then
correct = true;
end
return correct;
elseif randomText == "multiples of " then
if number%randomNumber == 0 then
correct = true;
end
return correct;
elseif randomText == "divisible by " then
if number%randomNumber == 0 then
correct …Run Code Online (Sandbox Code Playgroud)