网络编程
位置:首页>> 网络编程>> Python编程>> vscode使用chatGPT 的方法

vscode使用chatGPT 的方法

作者:土豆煮石头  发布时间:2022-10-10 15:55:38 

标签:vscode,chatGPT

vscode使用chatGPT

一、下载chatPGT

在拓展中找到chatGPT,我这里下载的是中文版

vscode使用chatGPT 的方法

二、使用

1.使用快捷键 ctrl+shift+p进行查找 chatGPT

2.点击请输入问题

vscode使用chatGPT 的方法

3.输入你的问题,回车,这样它就会进行代码的编写

vscode使用chatGPT 的方法

4.等一会儿就会给你结果啦

vscode使用chatGPT 的方法

三、现在来看看它写的怎样

生成的代码

import smtplib

# 设置发送方的邮件服务器和端口号
smtp_server = "smtp.qq.com"
smtp_port = 465

# 建立与邮件服务器的连接
server=smtplib.SMTP_SSL("smtp.qq.com", 465)
# server = smtplib.SMTP(smtp_server, smtp_port)

# 启用安全连接
server.starttls()

# 登录到邮件服务器
server.login("1256960051@qq.com", "xxxxx")

# 设置电子邮件的收件人,主题和内容
to = "1256960051@qq.com"
subject = "Hello!"
body = "Hello, world!"

# 组装并发送电子邮件
message = f"Subject: {subject}\n\n{body}"
server.sendmail("1256960051@qq.com", to, message)

# 断开与邮件服务器的连接
server.quit()

是不是十分简洁,还有代码的解释和为什么用这种方法,是不是很有用呢?

来源:https://www.cnblogs.com/zbfoot/p/16968902.html

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com