小编Anu*_*rag的帖子

在Firebase上使用Auth托管html?

我正在使用Mkdocs生成文档,并希望使用firebase但使用身份验证.

我在firebase上托管了没有身份验证的html,但没有找到任何身份验证解决方案.

任何帮助表示赞赏.

firebase firebase-hosting mkdocs

8
推荐指数
0
解决办法
386
查看次数

启用日志文件旋转到s3

我启用了此选项.

在此输入图像描述 问题是:

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)

amazon-s3 amazon-web-services amazon-elastic-beanstalk

5
推荐指数
1
解决办法
6036
查看次数

python中的列表操作

你给了一个清单.列表长度可以变化.

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)

有没有什么好方法可以在不使用IF/Else的情况下解决这个问题.

python

4
推荐指数
1
解决办法
917
查看次数

Python删除两个for循环并使用一些迭代器工具解决

我有一本字典

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)

有人可以告诉我另一种方法吗?使用一些迭代器工具或任何其他方式?

谢谢

python for-loop

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

要在python中映射的列表

我有一个列表,我想将此列表转换为地图

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)

python dictionary list python-itertools

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