小编Bri*_*all的帖子

将带有时区的python日期时间转换为字符串

我有格式为的日期时间元组 datetime.datetime(2010, 7, 1, 0, 0, tzinfo=<UTC>)

如何将其转换为日期时间字符串,例如 2008-11-10 17:53:59

我真的只是在 tzinfo 部分受阻。

strftime("%Y-%m-%d %H:%M:%S") 没有 tzinfo 部分就可以正常工作

python django python-datetime

12
推荐指数
1
解决办法
2万
查看次数

在 Fn::Transform 中使用 FindInMap 作为位置参数

当我尝试使用该Fn::FindInMap函数为某个Fn::Transform部分中的代码段提供位置时,我收到此错误

无法消化转换参数中的函数,转换块中的内在函数只能包含参数值或堆栈元数据。

在文档中它说我可以这样做。 这是文档

这是我的模板的两个相关部分

Fn::Transform:
  Name: 'AWS::Include'
  Parameters: {Location: {'Fn::FindInMap': [PipelineStackMap, dev, Location]}}


Mappings:
  PipelineStackMap:
    prod:
      Location: "s3://my-prod-cicd-bucket/pipeline.yml"
    dev:
      Location: "s3://my-cicd-bucket/pipeline.yml"
    qa:
      Location: "s3://my-cicd-bucket/pipeline.yml"
Run Code Online (Sandbox Code Playgroud)

当我使用Ref和 变量或对存储桶字符串进行硬编码时,它工作正常,而在使用FindInMap.

amazon-web-services aws-cloudformation

7
推荐指数
1
解决办法
667
查看次数