我在制作python字典或列表时遇到了问题



我对python很陌生,有一个在PowerShell中编写的脚本,我想在python中重新创建。

在powershell中,我创建了一个哈希表:

$epBody = @{
"escalation_policy"   = @{
"type"               =   "escalation_policy"
"name"               =   $epName
"escalation_rules"   = @(
@{
"escalation_delay_in_minutes" = 30
"targets"                     = @(
@{
"id"    = $userid
"type"  = "user_reference"
}
)
}
) 
}
}

并试图找出用python写这篇文章的最佳方式。

这就是我所拥有的(我知道这是错误的!(:

ep_payload = {
"escalation_policy": {
"type": "escalation_policy",
"name": epName,
"escalation_rules": [
{
"escalation_delay_in_minutes": 30,
"targets": [
{
"id": userid
"type": "user_reference"
}
]
}
] 
}
}

我只是想不出这个的正确语法

欢呼,

"让我们吃奶奶"让我们吃吧,奶奶;Commas拯救生命!

相关内容

最新更新