So after I made this code, it will open a new file but the code cannot write anything into the text file I have opened. Any ways that I can do this. It is sort of like when a user inputs his or her username, the text file will open accordingly, and what the user has typed or edit, the file will append and write them in the text file. But my code doesn't work. TT
You can use replit db which is replit’s own database
db[‘key’] = ‘value’ to set a value
value = db[‘key’] to get a value of a key from the database
del db[‘key’] to delete a key and value from the database
print(db.keys()) to get all of the keys and values in the database
and
from replit import db
to actually start the db
How do I edit a file with a specific name according to the user
So after I made this code, it will open a new file but the code cannot write anything into the text file I have opened. Any ways that I can do this. It is sort of like when a user inputs his or her username, the text file will open accordingly, and what the user has typed or edit, the file will append and write them in the text file. But my code doesn't work. TT
You can use replit db which is replit’s own database
@JW2005db[‘key’] = ‘value’ to set a value
value = db[‘key’] to get a value of a key from the database
del db[‘key’] to delete a key and value from the database
print(db.keys()) to get all of the keys and values in the database
and
from replit import db
to actually start the db