简体   繁体   中英

How to create a leader board in repl.it python

I'm trying to make a game with a leaderboard, and I have the code that writes the high scores in a file, but when multiple people play the game, they have separate leaderboards. so basically, i'm asking if there's a way to have everyone share a file in repl.it.

If your code is writing to local files eg via open('some_file.txt') , then those are limited to the individual user's Repl.it workspaces.

If you must use files, then you could use any of the Dropbox, Git, AWS S3, Google Drive Python libraries to read/write external files.

However, the better solution would be to use a hosted database solution and connect Repl.it to that. Some popular (free) examples include Firebase, Mongo Atlas, or Datastax Astra. For a simple leaderboard counter, then even Grafana Cloud.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM