1、获取文件方式
def get_file_data(self, dir):
if 'xls' in dir or 'xlsx' in dir:
app = xw.App(visible=True, add_book=False)
wb = app.books.open(dir)
sht = wb.sheets[0]
data_xls = sht.range('a2').expand('table').value
wb.close()
app.quit()
yield data_xls
elif 'csv' in dir:
data_csv = csv.reader(open(dir, encoding='utf-8'))
yield data_csv
elif 'txt' in dir:
data_txt = open(dir, encoding='utf-8').readlines()
yield data_txt
2、如何把表格里某一列的多条内容分裂出来
online_goods.drop('条形码', axis=1).join(online_goods['条形码'].str.split(',', n=5, expand=True).stack().reset_index(level=1, drop=True).rename('条形码'))
3、