'''python3读取excle数据''' import xlrd workbook = xlrd.open_workbook(r'test.xls', encoding_override='gbk') print(workbook.sheet_names()) sheet = workbook.sheet_by_name('Sheet 1') print(sheet.nrows, sheet.ncols) for i in range(sheet.nrows): for j in range
我们在用python进行数据处理时往往需要将文件中的数据取出来做一些处理,这时我们应该注意数据文件的路径.文件路径不对,回报如下错误: FileNotFoundError: File b'..Advertising.csv' does not exist 这里列举几种常见的文件路径 1.当文件在当前目录下时:直接用单引号文件名 import numpy as nppath='testdata.csv'data=np.read_csv(path) 2.文件在上一级目录时:大家注意windows读取
Python+selenium之读取配置文件内容 Python支持很多配置文件的读写,此例子中介绍一种配置文件的读取数据,叫ini文件,python中有一个类ConfigParser支持读ini文件. 将ini文件命名为config.ini,代码如下所示 #this is config file,only store browser type and server URL [browserType] #browserName=Firefox browserName=Chrome #browser