Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.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 使用GeoPy时的打印问题_Python_Python 3.x_Syntax Error_Geopy - Fatal编程技术网

Python 使用GeoPy时的打印问题

Python 使用GeoPy时的打印问题,python,python-3.x,syntax-error,geopy,Python,Python 3.x,Syntax Error,Geopy,我对Python完全陌生,所以我知道我可能在某个地方犯了一个基本的错误。当我执行以下操作时,在打印行之后会出现一个语法错误:无效语法错误。我做错了什么 import geopy.distance coords_1 = (52.2296756, 21.0122287) coords_2 = (52.406374, 16.9251681) print geopy.distance.distance(coords_1, coords_2).km 您正在Python3中键入Python2代码。pr

我对Python完全陌生,所以我知道我可能在某个地方犯了一个基本的错误。当我执行以下操作时,在打印行之后会出现一个语法错误:无效语法错误。我做错了什么

import geopy.distance

coords_1 = (52.2296756, 21.0122287)
coords_2 = (52.406374, 16.9251681)

print geopy.distance.distance(coords_1, coords_2).km

您正在Python3中键入Python2代码。print语句上需要有括号

代码:

导入地理距离 coords_1=52.2296756,21.0122287 coords_2=52.406374,16.9251681 printgeopy.distance.distancecoords_1,coords_2.km
希望这有帮助

您正在Python3中键入Python2代码。print语句上需要有括号

代码:

导入地理距离 coords_1=52.2296756,21.0122287 coords_2=52.406374,16.9251681 printgeopy.distance.distancecoords_1,coords_2.km
希望这有帮助

您正在用python3 intepreter编写python2代码您正在用python3 intepreter编写python2代码