我启用了此选项.
问题是:
If I don't press snapshot log button log, is not going to s3.
Run Code Online (Sandbox Code Playgroud)

Is there any method through which log publish to s3 each day?
Or how log file rotation option is working ?
Run Code Online (Sandbox Code Playgroud) 你给了一个清单.列表长度可以变化.
As an example:
1. ll = [1,2,3]
2. ll = [1,2,3,4]
3. ll = [1,2]
4. ll = []
Run Code Online (Sandbox Code Playgroud)
我想将值存储在三个变量中,
var1,var2,var3 = None,None,None
If ll[0] exists then var1 = ll[0]
If ll[1] exists then var2 = ll[1]
If ll[3] exists then var3 = ll[2]
Run Code Online (Sandbox Code Playgroud)
我已经写了解决方案,但它包含if else.我写的代码: -
var1,var2,var3 = None,None,None
if len(ll) == 1:
var1,var2,var3 = ll[0],None,None
elif len(ll) == 2:
var1,var2,var3 = ll[0],ll[1],None
else:
var1,var2,var3 = ll[0],ll[1],ll[2]
Run Code Online (Sandbox Code Playgroud)
我有一本字典
input = {
1:[23,24],
2:[21],
3:[23],
4:[]
}
Run Code Online (Sandbox Code Playgroud)
我想要这样的输出: -
output = (1,23),(1,24),(2,21),(3,23)
Run Code Online (Sandbox Code Playgroud)
我用两个for循环做了这个: -
>>> for key in input:
... for value in input[key]:
... print """(""" + str(key) + """,""" +str(value) + """)"""
...
(1,23)
(1,24)
(2,21)
(3,23)
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我另一种方法吗?使用一些迭代器工具或任何其他方式?
谢谢
我有一个列表,我想将此列表转换为地图
mylist = ["a",1,"b",2,"c",3]
Run Code Online (Sandbox Code Playgroud)
mylist相当于
mylist = [Key,Value,Key,Value,Key,Value]
Run Code Online (Sandbox Code Playgroud)
所以输入:
mylist = ["a",1,"b",2,"c",3]
Run Code Online (Sandbox Code Playgroud)
输出:
mymap = {"a":1,"b":2,"c":3}
Run Code Online (Sandbox Code Playgroud)
PS:我已经编写了以下函数来完成同样的工作,但我想使用python的迭代器工具:
def fun():
mylist = ["a",1,"b",2,"c",3]
mymap={}
count = 0
for value in mylist:
if not count%2:
mymap[value] = mylist[count+1]
count = count+1
return mymap
Run Code Online (Sandbox Code Playgroud)