python中如何识别当前位置?
我的客户在德国和美国有两个办事处,Python 程序应该识别办事处位置。实现这一点的最优雅的方式是什么?它只需要承认这个国家。此外,也可能会出现没有永久互联网连接的情况。该程序可以在 Windows 上运行,但解决方案应该与操作系统无关。
有什么建议吗? 谢谢
My client has two offices in Germany and USA and a python program should recognize the office location. What will be the most elegant way to implement this? It only have to recognize the country. Furthermore it also could happens that there will be no permanent internet connection. The program works on windows but the solution should be os independent.
Any suggestions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AFAIK,没有优雅的解决方案。您可以做出有根据的猜测,但是,举个例子:我在德国拔掉笔记本电脑的电源,去了美国。我将其插入美国办公室 - 区域设置相同,时区没有改变,现在怎么办?
您可以猜测的事情:
通过为每个事物分配分数并检查每个事物,您可以获得概率 计算计算机所在位置,但您可能会得到一些错误的猜测,因此也请进行手动覆盖。
在一般情况下,综合得分可能相当准确;你需要做的是找到边缘情况和角落情况,然后找到一些方法来识别它们。
AFAIK, there's no elegant solution. You can make educated guesses, but then, take this example: I unplug my laptop in Germany and go to the USA. I plug it in the US office - the regional settings are the same, the time zone didn't change, now what?
Things from which you can make a guess:
By assigning a score to each of these things, and checking for each, you could get a probability score where the computer is. You might get some incorrect guesses though, so make a manual override, too.
The combined score might be quite accurate in the general case; what you need to do is find the edge and corner cases, then find some way to identify those.