這篇文章主要為大家展示了“如何解決python多行注釋引發(fā)縮進(jìn)錯(cuò)誤的問題”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“如何解決python多行注釋引發(fā)縮進(jìn)錯(cuò)誤的問題”這篇文章吧。
創(chuàng)新互聯(lián)專注于太原網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供太原營(yíng)銷型網(wǎng)站建設(shè),太原網(wǎng)站制作、太原網(wǎng)頁(yè)設(shè)計(jì)、太原網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造太原網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供太原網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。如下所示:
m_start =date +' 09:00' m_end =date +' 13:00' rsv_1 ={ 'act':'set_resv', 'dev_id':dev_id, 'start':m_start, 'end':m_end, } ''' rsv_2 ={ '_':'', 'act':'set_resv', 'dev_id':dev_id, 'start':'2018-05-21 13:00', 'end_time':'', 'kind_id':'', 'lab_id':'', 'memo':'', 'prop':'', 'room_id':'', 'end':'2018-05-21 17:00', 'start_time':'', 'term':'', 'test_id':'', 'test_name':'', 'type_name':'', 'type':'dev', 'up_file':'', } rsv_3 ={ '_':'','act':'set_resv', 'dev_id':dev_id, 'start':'2018-05-21 17:00', 'end_time':'', 'kind_id':'', 'lab_id':'', 'memo':'', 'prop':'', 'room_id':'', 'end':'2018-05-21 21:00', 'start_time':'', 'term':'', 'test_id':'', 'test_name':'', 'type_name':'', 'type':'dev', 'up_file':'', } ''' session =requests.Session() req = session.post(init_url,data=keywords,headers=headers)
注意,這里的多行注釋會(huì)報(bào)縮進(jìn)錯(cuò)誤,原因是因?yàn)閜ython用縮進(jìn)標(biāo)志程序塊,包括注釋,所以,注釋同樣要注意與所要注釋的程序塊對(duì)齊.
改進(jìn)如下,請(qǐng)注意下面代碼中多行縮進(jìn)的縮進(jìn)情況:
m_start =date +' 09:00' m_end =date +' 13:00' rsv_1 ={ 'act':'set_resv', 'dev_id':dev_id, 'start':m_start, 'end':m_end, } ''' rsv_2 ={ '_':'', 'act':'set_resv', 'dev_id':dev_id, 'start':'2018-05-21 13:00', 'end_time':'', 'kind_id':'', 'lab_id':'', 'memo':'', 'prop':'', 'room_id':'', 'end':'2018-05-21 17:00', 'start_time':'', 'term':'', 'test_id':'', 'test_name':'', 'type_name':'', 'type':'dev', 'up_file':'', } rsv_3 ={ '_':'','act':'set_resv', 'dev_id':dev_id, 'start':'2018-05-21 17:00', 'end_time':'', 'kind_id':'', 'lab_id':'', 'memo':'', 'prop':'', 'room_id':'', 'end':'2018-05-21 21:00', 'start_time':'', 'term':'', 'test_id':'', 'test_name':'', 'type_name':'', 'type':'dev', 'up_file':'', } ''' session =requests.Session() req = session.post(init_url,data=keywords,headers=headers)
以上是“如何解決python多行注釋引發(fā)縮進(jìn)錯(cuò)誤的問題”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!