[英]Possible to use Mathematica from other programming languages (python/C#)?
[英]why does python loop continue work differently from other programming languages
在其他編程語言中,當在循環中遇到 continue 時,它不會運行它下面的代碼,而只是根據條件集執行下一個循環。
然而,在 python 中,它實際上不會在相同的確切值上觸發 continue 多達 3 次,直到 continue 最終真正觸發有人能告訴我為什么會這樣嗎?
功能
def get_section(self, address):
for section in self.sections:
section_base = section.image_base + section.VirtualAddress
section_end = section_base + section.Misc_VirtualSize
print 'section_base= 0x%x' % section_base, ' section_end = 0x%x' % section_end
print 'VirtualAdderss = 0x%x' % section.VirtualAddress, 'Misc_virtualSize = 0x%x' % section.Misc_VirtualSize
if address < section_base or address >= section_end:
print 'continuued'
continue
print 'not continuued'
print 'Section name = ', section.section_name
return section
raise NotImplementedError()
這是日志
address = 0x4013f8
section_base= 0x401000 section_end = 0x5574e5
VirtualAdderss = 0x1000 Misc_virtualSize = 0x1564e5
not continuued
Section name = text
address = 0x4013f8
section_base= 0x401000 section_end = 0x5574e5
VirtualAdderss = 0x1000 Misc_virtualSize = 0x1564e5
not continuued
Section name = text
address = 0x55869c
section_base= 0x401000 section_end = 0x5574e5
VirtualAdderss = 0x1000 Misc_virtualSize = 0x1564e5
continuued
section_base= 0x558000 section_end = 0x5818ac
VirtualAdderss = 0x158000 Misc_virtualSize = 0x298ac
not continuued
Section name = rdata
如您所見,它僅在第 3 次繼續運行時才沒有繼續 2 次,我不知道為什么它從第一次開始就不起作用了?
前兩次,不滿足if
條件; 因此沒有執行continue
語句。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.