分页: 1 / 1

求助 python sleep() 函数的诡异问题

发表于 : 2010-12-28 10:28
cazy9077
下为源码,其中调用的 sleep函数
很奇怪 延时功能并没有 在输出print 1 之后被调用
感觉上一进函数 首先调用 延时 然后再 print 1的
麻烦高手讲解下 谢谢 :)

代码: 全选

    def B_Connect(self,event):

        ftp =  FTP()
        
        try:
            ftp.connect(ftp_address, ftp_port)
            ftp.login(ftp_username, ftp_password)
           [color=#FF0000] print 1[/color]           
       try:
                file_handler = open(enconfig_file,'wb')
                get_file = 'RETR '+ enconfig_file
                ftp.retrbinary(get_file,file_handler.write)
                file_handler.flush()
                file_handler.close()
                ftp.quit()

            except:
                self.multiText.AppendText("Sorry, Cannot get the CIS Profiles\n")
            
        except:
            self.multiText.AppendText("Sorry, Cannot connect to CIS server\n")

 [color=#FF0000]       sleep(2)[/color]        #os.path.getsize('test.py')
        self.multiText.AppendText("Now you can scan your system\n")
    

Re: 求助 python sleep() 函数的诡异问题

发表于 : 2010-12-28 17:01
lilydjwg
代码好乱。。把你的代码用

代码: 全选

[python][/python]
包起来吧。

Re: 求助 python sleep() 函数的诡异问题

发表于 : 2010-12-28 21:47
icyomik
好乱,没有心情看了。