how to get user location in python

import geocoder		# pip install geocoder
g = geocoder.ip('me')
print(g.latlng)

Here is what the above code is Doing:
1. We’re using the geocoder package to get the latitude and longitude of the user’s IP address.
2. We’re printing the latitude and longitude of the user’s IP address.

You can also use the geocoder package to get the latitude and longitude of a specific address.

For example, if you wanted to get the latitude and longitude of the White House, you could use the following code:

import geocoder
g = geocoder.google(‘White House’)
print(g.latlng)

The above code would print the latitude and longitude of the White House.

You can also use the geocoder package to get the latitude and longitude of a specific address.

For example, if you wanted to get the latitude and longitude of the White House, you could use the following code:

import geocoder
g = geocoder.google(‘White House’)
print(g.latlng)

The above code would print the latitude and longitude of the White House.