How to use the prettytable.factory.from_csv function in prettytable

To help you get started, we’ve selected a few prettytable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kxxoling / PTable / prettytable / cli.py View on Github external
parser = argparse.ArgumentParser(description='A simple Python library designed to make it quick and easy to '
                                     'represent tabular data in visually appealing ASCII tables.')
    parser.add_argument('--csv', help='CSV file name')
    parser.add_argument('--md', help='Markdown file name')
    parser.add_argument('--rst', help='reStructuredText file name')
    args = parser.parse_args()

    if args.csv:
        with open(args.csv) as fp:
            print(from_csv(fp))
    elif args.md:
        with open(args.md) as md:
            print(from_md(md.read()))
    else:
        text_in = sys.stdin.read()
        print(from_csv(StringIO.StringIO(text_in)))
github kxxoling / PTable / prettytable / cli.py View on Github external
def main():
    parser = argparse.ArgumentParser(description='A simple Python library designed to make it quick and easy to '
                                     'represent tabular data in visually appealing ASCII tables.')
    parser.add_argument('--csv', help='CSV file name')
    parser.add_argument('--md', help='Markdown file name')
    parser.add_argument('--rst', help='reStructuredText file name')
    args = parser.parse_args()

    if args.csv:
        with open(args.csv) as fp:
            print(from_csv(fp))
    elif args.md:
        with open(args.md) as md:
            print(from_md(md.read()))
    else:
        text_in = sys.stdin.read()
        print(from_csv(StringIO.StringIO(text_in)))