Skip to content
← Back to Community
How to store (((numbers or text or variable))) internally?
Profile icon
wjustin

I want to save some text and numbers so that when i refresh the site, the numbers and text are like internally stored so when i code:

x = 1

...refresh site...

...delete "x = 1"...

print(x)

output:
1

Answered by Muffinlavania [earned 5 cycles]
View Answer
Voters
Profile icon
wjustin
Comments
hotnewtop
Profile icon
Muffinlavania

you can also use pickle, this is for saving variables, here is my tutorial on how to use it

Profile icon
wjustin

@Muffinlavania wow! even better than dynamicsquid (sry and no offence)

Profile icon
DynamicSquid

I get it. Okay, so you have to save it in a file. So in python, create a file named "filename.txt", and then check out this tutorial on file writing. files save data even after the program has closed. hope this helps :)

Profile icon
wjustin

@DynamicSquid ok thx i will mark this as best answer after i try it out.

Profile icon
wjustin

@DynamicSquid thx so much it just made my life easier
haha

Profile icon
DynamicSquid

@wjustin np :)

Profile icon
DynamicSquid

WAIT

Profile icon
DynamicSquid

I don't get it

Profile icon
wjustin
Profile icon
wjustin

@DynamicSquid its basically like you save things internally somewhere and u access it back

Profile icon
wjustin

anyone? sixbeeps or forarkld???