我如何让 python 检查列表是否发送到套接字服务器或从套接字服务器发送?

发布于 2024-12-05 04:06:35 字数 132 浏览 8 评论 0原文

我试图让一个泡菜文件“服务器端”存储玩家坐标列表。然后服务器将该 pickle 文件发送到客户端。另外,我需要一种方法让客户端在腌制文件中查找这些坐标。

我如何让客户查看包含各种不同信息的pickle 文件。并让它从文件中提取坐标吗?

I'm trying to have a pickle file "server side" store a list of player coordinates. Server then sends that pickle file to the client. Also, i need a way for the client to look in the pickled file, for those coordinates.

How would i have the client look in the pickle file that would have all sorts of different information. And have it pull the coordinates from the file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤君无依 2024-12-12 04:06:35

只需在客户端unpickle它并检查您需要验证的内容即可。

c = pickle.load( open( "fromserver.p" ) )

我假设您正在编写或正在编写服务器和客户端部分。在这种情况下,您需要预先决定存储和检索的内容。例如,如果您在服务器端的 pickle 文件中存储了一个名为 l 的列表,那么在客户端您可以取消pickle,并且可以将其作为 l 使用。

Just unpickle it at the client end and check for what you need to verify.

c = pickle.load( open( "fromserver.p" ) )

I am assuming that you are written or writing both the server and the client part. And in which case, you decided upfront what you store and retrieve. For e.g. if you stored a list named l in the pickle file at the server end, at the client end you can unpickle and it is available to you as l

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文