Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f90b0d

Browse files
committed
提交代码
1 parent eb1e1e6 commit 1f90b0d

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed

xianhuan/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Python技术 公众号文章代码库
1010

1111
## 实例代码
1212

13+
[几个有趣且有用的Python自动化脚本](https://github.com/JustDoPython/python-examples/tree/master/xianhuan/pyscripts):几个有趣且有用的Python自动化脚本
14+
1315
[用 Python 实现图片转字符画,so easy!](https://github.com/JustDoPython/python-examples/tree/master/xianhuan/charPic):用 Python 实现图片转字符画,so easy!
1416

1517
[绝了!自动点赞,我用 PyAutoGUI!](https://github.com/JustDoPython/python-examples/tree/master/xianhuan/pyautogui2):绝了!自动点赞,我用 PyAutoGUI!

xianhuan/pyscripts/draftPic

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import cv2
2+
3+
img = cv2.imread("C:\\pworkspace\\mypy\\pythontech\\funnyscripts\\elon.png")
4+
5+
## Image to Gray Image
6+
gray_image = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
7+
8+
## Gray Image to Inverted Gray Image
9+
inverted_gray_image = 255-gray_image
10+
11+
## Blurring The Inverted Gray Image
12+
blurred_inverted_gray_image = cv2.GaussianBlur(inverted_gray_image, (19,19),0)
13+
14+
## Inverting the blurred image
15+
inverted_blurred_image = 255-blurred_inverted_gray_image
16+
17+
### Preparing Photo sketching
18+
sketck = cv2.divide(gray_image, inverted_blurred_image,scale= 256.0)
19+
20+
cv2.imshow("Original Image",img)
21+
cv2.imshow("Pencil Sketch", sketck)
22+
cv2.waitKey(0)

xianhuan/pyscripts/pdfencry

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pikepdf
2+
3+
pdf = pikepdf.open("test.pdf")
4+
pdf.save('encrypt.pdf', encryption=pikepdf.Encryption(owner="your_password", user="your_password", R=4))
5+
pdf.close()

xianhuan/pyscripts/sendEmail

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import smtplib
2+
from email.message import EmailMessage
3+
import pandas as pd
4+
5+
def send_email(remail, rsubject, rcontent):
6+
email = EmailMessage()
7+
# 发件人邮箱
8+
email['from'] = '发件人邮箱'
9+
# 收件人邮箱
10+
email['to'] = remail
11+
# 主题
12+
email['subject'] = rsubject
13+
# 内容
14+
email.set_content(rcontent)
15+
with smtplib.SMTP(host='smtp.qq.com',port=25)as smtp:
16+
smtp.ehlo()
17+
smtp.starttls()
18+
# 授权码登录
19+
smtp.login("发件人邮箱","授权码")
20+
smtp.send_message(email)
21+
print("email send to ",remail)
22+
23+
if __name__ == '__main__':
24+
send_email('目标邮箱','test','test')
25+
26+

xianhuan/pyscripts/zipfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 解压文件
2+
from zipfile import ZipFile
3+
4+
unzip = ZipFile("C:\\Users\\cxhuan\\Downloads\\file_upload.zip", "r")
5+
unzip.extractall("C:\\Users\\cxhuan\\Downloads\\file_upload")

0 commit comments

Comments
 (0)