小编Shr*_*ava的帖子

附件在python中使用smptplib连接两次

我试图在python中实现一个功能,我想发送一个文件作为电子邮件提醒的附件一切正常.我收到了所需主题的电子邮件提醒,但唯一的问题是我在电子邮件提醒中两次获得相同的附件.

    fileMsg = email.mime.base.MIMEBase('application','octet-stream')
    fileMsg.set_payload(file('/home/bsingh/python_files/file_dict.txt').read())
    #email.encoders.encode_base64(fileMsg)
    fileMsg.add_header('Content-Disposition','attachment;filename=LogFile.txt')
    emailMsg.attach(fileMsg)

  # send email
    server = smtplib.SMTP(smtp_server)
    server.starttls()
    server.login(username, password)
    server.sendmail(from_add, to_addr,emailMsg.as_string())
    server.quit()
Run Code Online (Sandbox Code Playgroud)

python smtplib

7
推荐指数
2
解决办法
800
查看次数

如何在git中更新目录

我有一个bitbucket存储库,具有以下结构:

 Directory-A->
   directory a
   directory b
   file a
   file b
   file c
Run Code Online (Sandbox Code Playgroud)

现在我想将文件"b"和文件"c"移动到"目录a"

当我在本地机器上执行此操作并通过git add提交时.我在目录a中获取文件b和文件c但它们仍然存在于其外部.

git git-commit

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

枕头中的图像旋转

我有一个图像,我想将其转置30度。是否可以使用类似的东西

 spinPicture003 = Picture003.transpose(Image.Rotate_30)
Run Code Online (Sandbox Code Playgroud)

python pillow

5
推荐指数
2
解决办法
4277
查看次数

如果子类使用相同的方法名扩展两个类,则子类调用哪个方法

我有2个类--say A和B作为1个class -child类的父级,A和B类都有方法myMethod.现在,如果我在子类中调用mymethod,那么它指的是什么?

python python-2.7

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

标签 统计

python ×3

git ×1

git-commit ×1

pillow ×1

python-2.7 ×1

smtplib ×1