在python中将值写入excel中的一行中的单元格

我一直在试图写入数值生成Excel表格#1的值。 我没有得到任何错误或任何东西,但我也没有在Excel文件中得到任何输出。

还有一个简单的方法来查找行/列是单元格指向?

下面我有我的代码编写的计数从HTML特定的单词,这些值需要放在一个Excel文件。

from xlwt import Workbook import requests from bs4 import BeautifulSoup import re from selenium import webdriver from xlwt import Workbook from collections import Counter driver = webdriver.Firefox() driver.get("fetch dashboard link") login_test = driver.find_element_by_xpath('//*[@id="authContent"]/form/div/p[2]/a') login_test.click() driver.implicitly_wait(30) a = driver.page_source soup = BeautifulSoup(a, "html.parser") wb = Workbook() sheet1 = wb.add_sheet('Automation') sheet1.write_merge(0,2,0,0,'#') sheet1.write_merge(0,0,1,7,'Test Result') sheet1.write(1,1,'Component') sheet1.write(1,2,'Test Restult') sheet1.write(1,3,'Pass') sheet1.write(1,4,'Fail') sheet1.write(1,5,'Cannot Test') sheet1.write(1,6,'Pass With Concern') sheet1.write(1,7,'Pending') i = 3 j=1 for row_len in range (0,27): sheet1.write(i,0,j) i=i+1 j=j+1 class counter_class: def count(self, tittle, block_code): 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 fetched from the top to write it to a row in the excel file. f_r=3 f_c=1 sheet1.write(f_r, f_c, tittle) f_c= f_c + 2 sheet1.write(f_r, f_c, blockcode_passed) f_c= f_c + 1 sheet1.write(f_r, f_c, blockcode_fail) f_c= f_c + 1 sheet1.write(f_r, f_c, blockcode_cannot_test) f_c= f_c + 1 sheet1.write(f_r, f_c, blockcode_cannot_test) f_c= f_c + 1 sheet1.write(f_r, f_c, blockcode_passwc) f_c= f_c + 1 sheet1.write(f_r, f_c, blockcode_untested) f_c=1 f_r=4 print f_r print f_c wb.save('xlwtexample.xls') ##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)