修改IF语句程序以添加功能

时间:2019-12-24 17:57:26

标签: if-statement pycharm

Pycharm通过返回退出代码指示没有错误 0。所以我应该走正确的道路,尽管问题似乎在于Pycharm并未在整个程序中进行计算,因此没有达到预期的结果。 This is my code和您提供的任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

不应该,问题不在于PyCharm,您只是没有调用您定义的函数cost(Length, 0.87)。尝试通过在文件末尾添加行# Variables Fromflight = "Amsterdam" Toflight = "Hatay" DayFrom = "28" DayTo = "10" # Functions def InputInformation(): # Click on from input driver.find_element_by_xpath('/html/body/div[1]/div[5]/div/div/div[2]/ul/li[1]/div/form/div[2]/div[1]/div/span/span[1]/span').click() # Click on from input and put text on it driver.find_element_by_xpath('/html/body/span/span/span[1]/input').click() pyautogui.typewrite(Fromflight) pyautogui.typewrite(["enter"]) # Click on to input and put text on it driver.find_element_by_xpath('/html/body/div[1]/div[5]/div/div/div[2]/ul/li[1]/div/form/div[2]/div[2]/div/span/span[1]/span').click() pyautogui.typewrite(Toflight) pyautogui.typewrite(["enter"]) # Choose flight date driver.find_element_by_xpath('//td[@data-handler="selectDay"]/a[text()=' + DayFrom + ']').click() driver.find_element_by_xpath('/html/body/div[1]/div[5]/div/div/div[2]/ul/li[1]/div/form/div[3]/div[2]/div/div[2]/div/div[1]') driver.find_element_by_xpath('//*[@id="search-flight-datepicker-arrival"]/div/div[2]/table/tbody/tr/td[@data-handler="selectDay"]/a[text()=' + DayTo + ']').click() 来调用它,还有其他问题,例如您的函数不根据长度更改速率,而仅声明更改。使用this guide作为函数在Python中的工作方式的参考。