Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

python - 使用随机访问文件在python中做哈希表的最佳方法(Best way to do a hashtable in python, using random access files)

The gist: I host a discord server for players of another video game.

(要点:我为另一个视频游戏的玩家托管了一个不和谐的服务器。)

When the players join, they fill out an application, then are either accepted or denied.

(当玩家加入时,他们填写申请表,然后被接受或拒绝。)

When accepted, moderators then have to whitelist the players to the actual game server and we have to keep track of who is whitelisted, how long players are inactive for etc.

(接受后,主持人必须将玩家列入白名单到实际的游戏服务器中,并且我们必须跟踪谁被列入白名单,玩家闲置多长时间等。)

I have discord bots that help with this, but I am going to create another that will store a database of : Discord name, In game name (for whitelisting), is whitelisted, join time, etc. The discord bot Im going to write will be in python and from what ive seen, dictionaries are the default implementation of hashtables.

(我有不和谐的机器人可以帮助解决这个问题,但是我将创建另一个存储以下信息的数据库:不和谐名称,游戏名称(用于白名单),被列入白名单,加入时间等。在python中,从ive的角度来看,字典是哈希表的默认实现。)

TLDR: Is there a way that I could save a dictionary to a csv file and access a specific line from the actual file from the built-in dictionary?

(TLDR:有没有一种方法可以将字典保存到csv文件并从内置字典访问实际文件中的特定行?)

Or will I have to write my own hashtable database to be able to use random access files.

(还是我必须编写自己的哈希表数据库才能使用随机访问文件。)

Should I use a different data type instead?

(我应该使用其他数据类型吗?)

  ask by Colin Watterson translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...