我编写了一个类来计算html源代码中的术语。这个类接收被解析的不同对象。输出值存储在excel文件中
问题是:一旦我调用这个类,它就会得到完美的执行。我第二次调用它时,它重写了数据。我希望r,c在类中只初始化一次,并在调用不同对象时相应地更新值。以便它移到下一行
class counter_class:
def count(self, tittle, block_code, sheet1):
blockcode_passed = block_code.count("Passed")
#blockcode_blocked = block_code.count("Blocked")
blockcode_fail = block_code.count("Failed")
blockcode_retest = block_code.count("Retest")
blockcode_cannot_test = block_code.count("Cannot Test")
blockcode_completed = block_code.count("Completed")
blockcode_passwc = block_code.count("Pass With Concern")
blockcode_untested = block_code.count("Untested")
##writing the count values to excel
r=3
c=1
sheet1.write(r, c, tittle)
c= c + 2
sheet1.write(r, c, blockcode_passed)
c= c + 1
sheet1.write(r, c, blockcode_fail)
c= c + 1
sheet1.write(r, c, blockcode_cannot_test)
c= c + 1
sheet1.write(r, c, blockcode_passwc)
c = c + 1
sheet1.write(r, c, blockcode_untested)
r=r+1
c=c+1
##Apps gateway starts here
apps_gateway = soup.find_all("div", {"id":"group-3191427"})
apps_gateway_str = str(apps_gateway)
apps_gateway_obj=counter_class()
apps_gateway_obj.count("appsgateway",apps_gateway_str, sheet1)
有人能帮我找出解决这个问题的逻辑吗
目前没有回答
相关问题 更多 >
编程相关推荐