【问题标题】:How can I save the Cookies of each session in Python?如何在 Python 中保存每个会话的 Cookie?
【发布时间】:2021-06-24 13:40:24
【问题描述】:

如何在 python 中保存会话 cookie?

我知道我必须打开这样的文件

open('cookies.txt', "w")

但我不知道如何为每个会话保存 cookie

【问题讨论】:

标签: python cookies


【解决方案1】:

file1 = open("myfile.txt","w")

文字需要写在txt文件里面

L = ["HAI \n","Hello \n","How are you \n"]

写入txt文件

file1.writelines(L)

关闭文本文件

file1.close()

【讨论】:

    猜你喜欢
    • 2017-02-25
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 2018-05-26
    • 1970-01-01
    • 2023-03-11
    • 2017-12-31
    • 2020-10-20
    相关资源
    最近更新 更多