成功注册ChatGPT并体验

本文最后更新于 2023年10月26日。

注册过程简单说明

登录 https://chat.openai.com
需能全球上网,否则提示当前地区不可用。

注册和登陆选项,我们当然是注册了。注册可以直接用邮箱注册,或者使用微软或谷歌授权登陆。

我使用的是微软账户登录,确认名字之后进入手机号填写页面,这个是关键,因为不支持国内手机号码注册。

最先想得到的是找一次性接码平台,然而免费的接码平台号码基本都被用过了。

只得使用付费的,我使用的是sms-activate

使用前需要注册充值,使用支付宝最低充值1美元。
2023年9月使用时支付宝最低充值2美元。

在网站左侧服务搜索“openai”就能出现相关号码和价格 。

找了几个便宜的都没成功。好在只要没有成功收到验证码,钱会退回。

最后哈萨克斯坦成功收到验证码,注册chatgpt成功。

然后就可以开始使用了。

ChatGPT初体验

尝试第一个问题: python tkinter写一个递归获取所有文件的ui程序

刚开始使用的是英国ip,报错:

An error occurred. If this issue persists please contact us through our help center at help.openai.com.

切换成美国ip后成功。

完整答案如下:

好的,以下是一个使用 Python Tkinter GUI 库编写的递归获取所有文件的 UI 程序的示例代码。代码实现了一个窗口,用户可以指定要搜索的目录和搜索的关键字,然后程序会递归遍历指定目录下的所有文件和子目录,查找包含指定关键字的文件,并将它们显示在窗口中的列表框中。

import os
import tkinter as tk
from tkinter 
import filedialog
class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()
    def create_widgets(self):
        self.dir_label = tk.Label(self, text=Select directory to search:)
        self.dir_label.pack()
        self.dir_button = tk.Button(self, text=Browse, command=self.browse_dir)
        self.dir_button.pack()
        self.keyword_label = tk.Label(self, text=Keyword to search:)
        self.keyword_label.pack()
        self.keyword_entry = tk.Entry(self)
        self.keyword_entry.pack()
        self.search_button = tk.Button(self, text=Search, command=self.search_files)
        self.search_button.pack()
        self.file_listbox = tk.Listbox(self)
        self.file_listbox.pack()
    def browse_dir(self):
        self.dir_path = filedialog.askdirectory()
        self.dir_label.configure(text=self.dir_path)
    def search_files(self):
        self.file_listbox.delete(0, tk.END) # clear existing results
        keyword = self.keyword_entry.get()
        if not self.dir_path or not keyword:
            return
        for root, dirs, files in os.walk(self.dir_path):
            for file in files:
                filepath = os.path.join(root, file)
                try:
                    with open(filepath, 'r') as f:
                        if keyword in f.read():
                            self.file_listbox.insert(tk.END, filepath)
                except:
                    continueif __name__ == __main__:
    root = tk.Tk()
    app = Application(master=root)
    app.mainloop()

这个程序创建了一个名为 Application的 Tkinter 窗口应用程序。程序窗口包含三个部分:

  1. Select directory to search:一个标签,用于显示用户选择的搜索目录路径。
  2. Keyword to search:一个标签和一个输入框,用于指定要搜索的关键字。
  3. Search:一个按钮,用于启动文件搜索。

搜索结果将显示在窗口中的列表框中,用户可以在其中选择查看文件。在点击 Browse按钮后,会弹出一个目录选择框,用户可以选择要搜索的目录。搜索结果将在用户点击 Search按钮后显示出来。
界面如下,虽然简陋但是可以正常使用