项目首页是用cms实现的,现在首页要改版,我们想将某些模块内容(如列表)单独分离出来成一个静态页面,然后像jsp中将页面include进来,不知有没有办法完成?一句话概括就是:有没有方法在用cms系统做的首页中嵌入一个单独的静态页面?谢谢。
1条回答 默认 最新
nfhnb 2015-11-10 10:09关注#coding: utf8
import re
import xlrd
def get_excel():
###文件绝对路径
xfile=r'D:\test\6yue.xlsx'
book=xlrd.open_workbook(xfile)
###打开第3个SHEET页
table=book.sheets()[2]
###标识字典
b_list={}
biaoshi=''
###获取行数和列数
nrows=table.nrows
ncols=table.ncols###获取标识头 for i1 in range(ncols): for j in table.col_values(i1): b_list[i1]=j break ###打印表头 for i2 in b_list: print i2,b_list[i2] biaoshi=biaoshi+b_list[i2]+' ' ###在列里面进行查询 chaxun1=int(raw_input(u'请输入你要查询的字段对应号(参照上图):\n')) chaxun_neirong=raw_input(u'请输入你要查询的字段内容:\n') for i3 in table.col_values(chaxun1): if re.search(chaxun_neirong,i3): #for i in enumerate() i3=re.search(chaxun_neirong,i3).group() ###判断搜索数据在哪行并打印 print biaoshi for k in range(nrows): huajian=table.cell(k,chaxun1).value if re.search(chaxun_neirong,huajian): for m in table.row_values(k): print m, print '\n' else: passget_excel()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报