我新的編程,我試圖運行使用終端這條巨蟒程序並得到錯誤:File "abc1234.py", line 9 time.sleep(3) IndentationError: expected an indented block ^
文件「abc1234.py」,9號線time.sleep(3)^ IndentationError:預計縮進塊
import webbrowser
import time
time_total=3
time_count=0
print (" the current time is " +time.ctime())
while(time_count<time_total):
time.sleep(3)
webbrowser.open("https://www.youtube.com/results?search_query=raabta+song+deepika")
time_count= time_count+1
該代碼工作。但是我使用文本編輯器「TextWrangler」,而使用「while循環」時,我必須手動添加空格,因爲在while循環中它直接將我帶到下一行而無需像您在循環 – Richa
你可以嘗試使用tab鍵嗎?不過,我認爲如果它具有python語言支持,則可以在首選項的某個位置啓用自動縮進並將其定義爲4個空格。我不確定,因爲我個人不使用TextWrangler。 –
工作..謝謝你@ dor-ron – Richa