我是python的新手。我有一个问题,想寻求答案。 有我的课:
class DoSomethingWithList :
def inputList(self, parameter_list):
...
def deleteSomething(self):
...
和
的其余部分temp = 0
while temp == 0 :
selection = input('input selection: ')
list1 = DoSomethingWithList()
if selection == 1 :
RangeOfList = int(input('input range of list : '))
list1.inputList(RangeOfList) # this is not executed
elif selection == 2 :
list1.deleteSomething() # and this too
else :
temp = 1
此代码永远循环。未执行list1对象。我在这里看不到问题。对不起,我的英语不好
答案 0 :(得分:1)
输入函数读取字符串而不是数字。您应该将if条件从'selection == 1'更改为'selection ==“ 1”',如下所示
$query = http_build_query([
'app_id' => 'your-app-id',
'app_code' => 'your-app-code',
'searchtext' => '123 Some Address',
]);
$url = 'https://geocoder.api.here.com/6.2/geocode.json?' . $query;
$json = file_get_contents($url);
$details = json_decode($json, TRUE);
var_dump($details);