我有以下功能:
def infinite_count():
a = 1
while a <= int(reciever_runtime):
send_message(float(reciever_sleeptime),a)
print_stats()
else:
print ("All the messages have been sent")
每当我运行我的代码时,我都会收到以下错误:
send_message(float(reciever_sleeptime), message_to_send)
^
SyntaxError: invalid syntax
这里是send_message()函数的代码:
def send_message(sleep_time, send_msg):
#Entering the message
#Setting path to the textbox
message_textbox = driver.find_element_by_xpath("""//*[@id="composerInput"]""")
#Typing the message
message_textbox.send_keys(send_msg)
#Sending the message
#Setting path
send_button = driver.find_element_by_xpath("""//*[@id="u_0_5"]""")
#Clicking the button in order to send the message
send_button.click()
#Wait time before sending another message IN SECONDS!
time.sleep( sleep_time )
发生了什么事?我使用的是Python 3.5
答案 0 :(得分:0)
由于代码正常工作,这是重现错误所需的所有代码。原因在于你如何缩进代码,正如@ReutSharabani在评论中所说的那样。