Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用python获得我们的确切位置(纬度和经度)?_Python_Python Requests_Latitude Longitude - Fatal编程技术网

如何使用python获得我们的确切位置(纬度和经度)?

如何使用python获得我们的确切位置(纬度和经度)?,python,python-requests,latitude-longitude,Python,Python Requests,Latitude Longitude,我想找到我现在住的地方的坐标。我尝试使用如下代码: send_url = 'http://freegeoip.net/json' r = requests.get(send_url) j = json.loads(r.text) lat = j['latitude'] lon = j['longitude'] 它给了我城市坐标。但我现在要我的位置坐标。怎么才能做到呢?这对我来说很有效 from selenium import webbrowser a=webdriver.Chrome() a.

我想找到我现在住的地方的坐标。我尝试使用如下代码:

send_url = 'http://freegeoip.net/json'
r = requests.get(send_url)
j = json.loads(r.text)
lat = j['latitude']
lon = j['longitude']
它给了我城市坐标。但我现在要我的位置坐标。怎么才能做到呢?

这对我来说很有效

from selenium import webbrowser
a=webdriver.Chrome()
a.get("https://www.google.com/maps")
print(a.execute_script("window.location"))

我会这样做:我必须替换上面代码中的url吗?你必须得到页面的html,然后解析它。我会贴一个例子。是的,它会有用。你认为计算机或网站如何知道你的确切位置?它不适合我。结果显示“无”。我正在使用seleniumHuh的webdriver。为我工作你能告诉我窗户的位置吗