我正在尝试用 python 发送电子邮件,但它一直说ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056). 这是我的代码:
server = smtplib.SMTP_SSL('smtp.mail.com', 587)
server.login("something0@mail.com", "password")
server.sendmail(
"something0@mail.com",
"something@mail.com",
"email text")
server.quit()
Run Code Online (Sandbox Code Playgroud)
你知道有什么问题吗?
我正在制作一个通过 压缩文件夹的脚本shutil.make_archive,但文件夹可能很大,所以需要一段时间。有什么方法可以显示完成的百分比吗?到目前为止,我一直在检查该threading模块,但还没有发现太多
这是我想要的输出的示例:
ubuntu@ubuntu:~$./script foldername
Compressing foldername.zip (15%)
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是我的代码:
ubuntu@ubuntu:~$./script foldername
Compressing foldername.zip (15%)
Run Code Online (Sandbox Code Playgroud)
您可以进行任何必要的更改以使其正常工作
我正在尝试获取列表的所有组合。下面是一个例子:
>>> l = [1, 2, 3]
>>> combo = something
>>> print(combo)
[1, 2, 3, 12, 13, 21, 23, 31, 32, 123, 132, 213, 231, 312, 321]
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止尝试过的:
>>> import itertools
>>> numbers = [1, 2, 3]
>>> l = list(itertools.permutations(numbers))
>>> print(l)
[(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]
Run Code Online (Sandbox Code Playgroud)
我如何获得输出[1, 2, 3, 12, 13, 21, 23, 31, 32, 123, 132, 213, 231, 312, 321]?
I am trying to make it so that every even thing in a list goes to one variable, and every odd one goes to another. For example, let's say x = ["a", "b", "c", "d"]. How would I make y = ["a", "c"] and z = ["b", "d"]?
I have not made any script with this yet, but I will in the future