小编Sha*_*ngh的帖子

在python 3中导入,请解释输出

内容:

tutorials/maindir/
??? dir1
?   ??? file11.py
?   ??? file12.py
?   ??? __init__.py
?   ??? __pycache__
?       ??? file11.cpython-36.pyc
?       ??? __init__.cpython-36.pyc
??? dir2
?   ??? file21.py
?   ??? file22.py
?   ??? __init__.py
??? file1.py
??? file2.py
??? __init__.py
??? __pycache__
    ??? file1.cpython-36.pyc
    ??? __init__.cpython-36.pyc
Run Code Online (Sandbox Code Playgroud)

现在我有一个代码给我下面没有得到的输出。

代码::

print("--main--", dir())
from tutorials.maindir import *
print("--main--", dir())
Run Code Online (Sandbox Code Playgroud)

输出::

--main-- ['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
tutorials
tutorials.maindir
tutorials.maindir.dir1
--main-- ['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'dir1', …
Run Code Online (Sandbox Code Playgroud)

python python-import python-3.x

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

FCM 令牌是否可以重复使用?

假设生成了一个 FCM 令牌abcd并将其分配给用户,user 1假设现在该令牌不再与user 1他卸载应用程序相关联。将来可以将此令牌abcd分配给其他用户吗?

编辑1:

我知道这是unique一次。但是,如果令牌没有被任何人使用,abcd其他用户是否会再次使用该令牌,因为它仍然是唯一的,就像user 1使用不同的令牌一样?

编辑2:

我指的令牌是device regestration token.

firebase firebase-authentication firebase-cloud-messaging

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

与 sshpass 一起使用时出现错误“sudo:不存在 tty 并且未指定 Askpass 程序”

我想编写一个脚本,在其中需要从不同的计算机获取文件的内容192.168.0.2而不输入密码,因此我使用sshpass以下命令:

sshpass -p "password" ssh -o StrictHostKeyChecking=no user@192.168.0.2 " ls /root/path/of/file"
Run Code Online (Sandbox Code Playgroud)

输出 :

ls: cannot access '/root/path/of/file': Permission denied
Run Code Online (Sandbox Code Playgroud)

我明白了,因为我没有以root用户身份登录。所以我尝试了:

sshpass -p "password" ssh -o StrictHostKeyChecking=no user@192.168.0.2 "sudo ls /root/path/of/file"
Run Code Online (Sandbox Code Playgroud)

输出 :

sudo: no tty present and no askpass program specified
Run Code Online (Sandbox Code Playgroud)

我应该怎么办?

shell sudo sshpass

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