• 大小: 10KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: Python
  • 标签:

资源简介

csv2tex-将 csv 数据变成 LaTeX 表格

资源截图

代码片段和文件信息

#!/usr/bin/env python3
import configparser as cp
from sys import argvexitstdoutstderr
from numpy import genfromtxt
from math import logfloor
from getopt import gnu_getopt

################################################################################
#                                                                              #
#    csv2tex.py                                                                #
#    Copyright (C) 2015  Lucas Luigi Treffenstädt (lucas@treffenstaedt.de)     #
#                                                                              #
#    This program is free software; you can redistribute it and/or modify      #
#    it under the terms of the GNU General Public License as published by      #
#    the Free Software Foundation; either version 2 of the License or         #
#    (at your option) any later version.                                       #
#                                                                              #
#    This program is distributed in the hope that it will be useful           #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of            #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             #
#    GNU General Public License for more details.                              #
#                                                                              #
#    You should have received a copy of the GNU General Public License along   #
#    with this program; if not write to the Free Software Foundation Inc.   #
#    51 Franklin Street Fifth Floor Boston MA 02110-1301 USA.               #
#                                                                              #
################################################################################

def getColumn(config section):
    if(“column“ in config.options(section)):
        return int(config.get(section“column“))-1
    else:
        print(“Error: no column defined for “+section)
        exit(1)

def getError(config section):
    if(“error“ in config.options(section)):
        return int(config.get(section“error“))-1
    else:
        return None

def getAlignment(config section):
    if(“alignment“ in config.options(section)):
        return config.get(section“alignment“)
    else:
        return “c“

def gettitle(config section):
    if(“title“ in config.options(section)):
        return config.get(section“title“)
    else:
        return section

def getPrecision(config section):
    if(“precision“ in config.options(section)):
        return int(config.get(section“precision“))
    else:
        return None

def getScale(config section):
    if(“scale“ in config.options(section)):
        return float(config.get(section“scale“))
    else:
        return 1

def getErrorScale(config sectionscale):
    if(“error_scale“ in config.options(section)):
        return float(config.get(section“error_scale“))
    else:
        return scale

def printSmart(string out

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-07-13 08:04  csv2tex-master\
     文件       15238  2015-07-13 08:04  csv2tex-master\LICENSE
     文件        3189  2015-07-13 08:04  csv2tex-master\README
     文件        6825  2015-07-13 08:04  csv2tex-master\csv2tex.py
     文件         230  2015-07-13 08:04  csv2tex-master\example.conf
     文件         427  2015-07-13 08:04  csv2tex-master\example.dat

评论

共有 条评论