Giter VIP home page Giter VIP logo

pylsy's Introduction

Pylsy

Build Status PyPI version

Pylsy is a simple Python library for drawing tables in the terminal/console. Just two lines of code!

Screenshot

Install

pip3 install pylsy

Sample Usage

# In the very first, pylsy needs to be imported
from pylsy import pylsytable

# First, you need to create a list, which will contain the table attributes:
attributes=["name","age","sex","id","time"]

# Then feed it to PylsyTable to create the table object:
table=pylsytable(attributes)

# Now populate the attributes with values. Prepare a list for the names:
name=["sun","lsy","luna"]

# Add the data into it:
table.add_data("name",name)

# If you want to insert some extra values to the same column,
# you can pass a list as a parameter:
table.append_data("name",["leviathan"])

# Just a single value is OK too:
table.append_data("name",u"小明") # Note: everything will be coerced to unicode strings.

# Now with all your attributes and values, we can create our table:
print(table)

# With Python 2 things are a bit trickier, since str() is ascii-only and our dear 小明 requires unicode:
print(table.__str__()) # The raw unicode-enabled string. Think as `table.__unicode__()`.

License

MIT

pylsy's People

Contributors

artoria2e5 avatar bcho avatar choleraehyq avatar drnightmare avatar gnithin avatar leviathan1995 avatar oldpanda avatar polyzy avatar shinux avatar suhussai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.