猫史档案馆


勤奋的程序喵

勤奋的程序喵

Lv.1

欢迎协作

获赞:137收藏:11浏览:1033作品收藏:23
回复帖子评论
上一页2 页 / 共 2下一页

优质素材提供:近期开发计划(本帖无害) 中回复

我想做

2024-04-27T15:36:36 点赞:0

python求助 中回复

?代码有问题吧

2024-04-29T16:36:58 点赞:0

如何永久保存变量? 中回复

我觉得把一个文件写入信息,需要时再解码,这样应该是一个模拟云变量了吧

2024-05-16T17:47:27 点赞:0

如何永久保存变量? 中回复

import os

if not os.path.exists('data.txt'):
    with open('data.txt','w') as f:
        f.write('写入的信息')
#解码
with open('data.txt', 'r', encoding='utf-8') as f:
        data = f.read().splitlines()
print(data)

2024-05-16T17:55:52 点赞:0