def toTable(self, tafla = None, title = None, heading = None): listrep = self.getListRep() if tafla is None: tafla = table(tafla,title,heading) places = u.getLocations(listrep, lambda t: True if t != "" else False) (x,y) = places[0] print "F*g: %s" % (listrep[x][y].split()[0],) if not self.litur: self.litur = raw_input("HTML litur: ") for (i,j) in places: tafla.addToTable(listrep[i][j],self.litur,i,j) return tafla
for (path,litur) in args: pars = parser(path,litur) tafla = pars.toTable(tafla) if not options.outname: tafla.save(loadname) with open(loadname[:len(loadname)-2] + '.html', 'w') as f: f.write(tafla.generatePage()) else: if len(args) > 0: pars = parser(args[0][0], args[0][1]) tafla = pars.toTable(title = options.title, heading = options.heading) for (path,litur) in args[1:]: pars = parser(path,litur) tafla = pars.toTable(tafla) if not options.outname: ed = editor(table(),dic) tafla = ed.edit() name = raw_input("Skrárnafn til að vista töflu og html: ") tafla.save(name +'.p') with open(name + '.html', 'w') as f: f.write(tafla.generatePage()) if options.outname: tafla.save(options.outname +'.p') with open(options.outname + '.html', 'w') as f: f.write(tafla.generatePage())