• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

Python 中线程部分的代码实践求教 主要是类的

import mathimport timefrom threading import Threadclass SquareRootCaluatotor:    """This class spawn a separate thread to calculate a bunch of square roots ,and checks in it once a second until it finishes"""    def __init__(self,target):        """Turn on the calculator thread and,while waiting for it to finish,periodically monitor its progress"""        self.result = []        counter = self.CalculatorThread(self,target)        print("Turning on the calculator thread")        counter.start()        while len(self.result)1:            limit = sys.argv[1]            try:                limit = int(limit)            except ValueError:                print("Usage:%s [number of square roots to calculate"                % sys.argv[0])        SquareRootCaluatotor(limit)求教:1在给SquareRootCaluatotor类实例后运行,总是提示无CalculatorThread属性,请问这是为什么?
            2 这个文件的正确运行步骤是什么?我给SquareRootCaluatotor赋变量运行是否正确?

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!