{ "info": { "author": "Mike Taylor", "author_email": "mike@taylortree.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "printio\n=======\n*printio* is a MIT licensed pretty printing library implemented in Python.\n\nFormat a value(s) for printing or display using Python's built-in String Format library.\n\nMost of the string formatting options from the Format Specification Mini-Language are available. See the formatting options here:\n http://docs.python.org/release/3.1.2/library/string.html#format-specification-mini-language\n\n\nFeatures\n--------\n - Align values to the left, right, or center.\n - Pad and fill values.\n - Sign numerical values.\n - Convert integers to float.\n - Specify precision for floating values - values are rounded up.\n - Convert numbers to percentage formats. Ex. 0.10 ~ 10.0000%\n - Add column headers or utilize default headers for your values.\n - Column widths are automatically sized based on maximum width of the values.\n - Choose which columns to format in your values.\n - Ability to print to 'text' similar to how MySQL displays output to the console.\n\n\nOverview\n--------\nThe major functions of printio:\n\n - *PrettyValue():*\n Formats a single value to a string.\n\n - *PrettyValues():*\n Formats a list of lists or dicts.\n - format: will return a list of strings including the header.\n - text: will return a string similar to MySQL's console display format.\n\n \nLicense\n-------\nMade available under the MIT License.\n\n\nUsage\n-----\nFirst, some housekeeping items...\n\nImport the library ::\n \n >>> from printio import PrettyValue\n >>> from printio import PrettyValues\n\nCreate a list of values you wish to format. ::\n\n >>> lol = []\n >>> lol.append([0, 'yhoo', 23.45])\n >>> lol.append([1, 'goog', 200.4565])\n >>> lol.append([2, 't', 1.00])\n \nLet's also create a list of dictionaries to format as well. ::\n \n >>> keys = ['bar', 'symbol', 'close']\n >>> lod = [dict(zip(keys, x)) for x in lol]\n \nNow, let's get down to business...\n \nFormat a string with a width of 10, center-aligned, and filled with '-'. ::\n \n >>> value = 'yhoo'\n >>> pv = PrettyValue('^10', fill='-')\n >>> pv.format(value)\n ---yhoo---\n\nFormat a float with a decimal precision of 1. ::\n \n >>> value = 23.45599\n >>> pv = PrettyValue('.1f')\n >>> pv.format(value)\n '23.5'\n\nFormat a float into a percentage. ::\n \n >>> value = 0.025\n >>> pv = PrettyValue('.2%')\n >>> pv.format(value)\n '2.50%'\n\nFormat a list. ::\n \n >>> pv = PrettyValues()\n >>> for row in pv.format([lol[0]]): print row\n ['0', '1 ', '2 ']\n ['0', 'yhoo', '23.45']\n \nFormat a dict. ::\n \n >>> pv = PrettyValues()\n >>> pv.newcol('bar')\n >>> pv.newcol('symbol')\n >>> pv.newcol('close')\n >>> for row in pv.format([lod[0]]): print row\n ['bar', 'symbol', 'close']\n ['0 ', 'yhoo ', '23.45']\n \nFormat a list of lists. ::\n \n >>> pv = PrettyValues()\n >>> for row in pv.format(lol): print row\n ['0', '1 ', '2 ']\n ['0', 'yhoo', '23.45 ']\n ['1', 'goog', '200.4565']\n ['2', 't ', '1.0 ']\n\nSame as above but this time in text. ::\n \n >>> pv = PrettyValues()\n >>> results = pv.text(lol)\n >>> print results\n +---+------+----------+\n | 0 | 1 | 2 |\n +---+------+----------+\n | 0 | yhoo | 23.45 |\n | 1 | goog | 200.4565 |\n | 2 | t | 1.0 |\n +---+------+----------+\n\nWant to add better column names? ::\n \n >>> pv.newcol(0, cname='Bar')\n >>> pv.newcol(1, cname='Symbol')\n >>> pv.newcol(2, cname='Close')\n >>> print pv.text(lol)\n +-----+--------+----------+\n | Bar | Symbol | Close |\n +-----+--------+----------+\n | 0 | yhoo | 23.45 |\n | 1 | goog | 200.4565 |\n | 2 | t | 1.0 |\n +-----+--------+----------+\n\nPrint only the Close column, always show sign, and format with decimal precision of 2. ::\n \n >>> pv = PrettyValues()\n >>> pv.newcol(2, '+.2f', cname='Close')\n >>> print pv.text(lol)\n +---------+\n | Close |\n +---------+\n | + 23.45 |\n | +200.46 |\n | + 1.00 |\n +---------+\n\nPrint list of dictionaries with the numerical settings for the bar & close. ::\n \n >>> pv = PrettyValues()\n >>> pv.newcol('bar', 'i')\n >>> pv.newcol('symbol')\n >>> pv.newcol('close', '.2f')\n >>> print pv.text(lod)\n +-----+--------+--------+\n | bar | symbol | close |\n +-----+--------+--------+\n | 0 | yhoo | 23.45 |\n | 1 | goog | 200.46 |\n | 2 | t | 1.00 |\n +-----+--------+--------+\n\n\nRoadmap\n-------\n* Add option to display title in addition to column headings.\n* Add autonum column ability.\n* Add tb_html to format to a html table.\n* Add pre_html to format
 html 
.\n\n\nFor additional information, please email:\n mike@taylortree.com", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/taylortree/printio", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "printio", "package_url": "https://pypi.org/project/printio/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/printio/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/taylortree/printio" }, "release_url": "https://pypi.org/project/printio/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "The printio library in Python.", "version": "0.0.2" }, "last_serial": 796696, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "72e13bb4f27f62952b89df492269c252", "sha256": "4afbf3865c3056363aec7ea05810472277a9939af2e9c96c181cb072b3ee4f7c" }, "downloads": -1, "filename": "printio-0.0.1.win32.exe", "has_sig": false, "md5_digest": "72e13bb4f27f62952b89df492269c252", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 211733, "upload_time": "2012-02-09T02:50:19", "url": "https://files.pythonhosted.org/packages/60/1e/27f9cbbb33d66f0a968be4d08e13de41db09fae1a5e1c41fe50f7371c84f/printio-0.0.1.win32.exe" }, { "comment_text": "", "digests": { "md5": "f646ec125c792ed8647a180e9e9af62a", "sha256": "0e34234e58e8e8e7e3271f28636152fa66ea176426d924a31103649b48bae7d8" }, "downloads": -1, "filename": "printio-0.0.1.zip", "has_sig": false, "md5_digest": "f646ec125c792ed8647a180e9e9af62a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16194, "upload_time": "2012-02-09T02:50:16", "url": "https://files.pythonhosted.org/packages/62/f4/a939d2fa0dc4760eed2ba5ea167a75ab0e9a18687e1f203deeed32aa3e71/printio-0.0.1.zip" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "7359ff1cefc750e6cb9a7cec3ec0b45d", "sha256": "aabc61e3e96f13492f6a08b717fd4a2e1894ef22e2befd31da2c338fa44d5ab9" }, "downloads": -1, "filename": "printio-0.0.2-py2.6.egg", "has_sig": false, "md5_digest": "7359ff1cefc750e6cb9a7cec3ec0b45d", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 22761, "upload_time": "2012-08-24T17:27:05", "url": "https://files.pythonhosted.org/packages/31/9c/77cd5a426c1311ed54c867004aa612144f43ae246ea3d519a1064eb0c24a/printio-0.0.2-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "fb656a38eb960f9e03f289e7ca8988bf", "sha256": "c4e777576e47422f7c2fb77a55fcc51e86c3f91bb1493cc32ff9cbd7bfe10a87" }, "downloads": -1, "filename": "printio-0.0.2.win32.exe", "has_sig": false, "md5_digest": "fb656a38eb960f9e03f289e7ca8988bf", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 212339, "upload_time": "2012-08-24T17:27:08", "url": "https://files.pythonhosted.org/packages/8c/cb/c497fe88e172b1eb8da011b93011840fcc122c5b62f0a2bc6576ae6b8124/printio-0.0.2.win32.exe" }, { "comment_text": "", "digests": { "md5": "52545a04a25f2ad824bf57165855a449", "sha256": "ae246ea624b6fe6c4d5264ac967edfeca556bbb2c10321b670380d3cb1b425ac" }, "downloads": -1, "filename": "printio-0.0.2.zip", "has_sig": false, "md5_digest": "52545a04a25f2ad824bf57165855a449", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16819, "upload_time": "2012-08-24T17:27:03", "url": "https://files.pythonhosted.org/packages/00/13/ecd786a57df2e5fa0344b94fbe5c5f2cacbc7389e451b6f5c633de6cca41/printio-0.0.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7359ff1cefc750e6cb9a7cec3ec0b45d", "sha256": "aabc61e3e96f13492f6a08b717fd4a2e1894ef22e2befd31da2c338fa44d5ab9" }, "downloads": -1, "filename": "printio-0.0.2-py2.6.egg", "has_sig": false, "md5_digest": "7359ff1cefc750e6cb9a7cec3ec0b45d", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 22761, "upload_time": "2012-08-24T17:27:05", "url": "https://files.pythonhosted.org/packages/31/9c/77cd5a426c1311ed54c867004aa612144f43ae246ea3d519a1064eb0c24a/printio-0.0.2-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "fb656a38eb960f9e03f289e7ca8988bf", "sha256": "c4e777576e47422f7c2fb77a55fcc51e86c3f91bb1493cc32ff9cbd7bfe10a87" }, "downloads": -1, "filename": "printio-0.0.2.win32.exe", "has_sig": false, "md5_digest": "fb656a38eb960f9e03f289e7ca8988bf", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 212339, "upload_time": "2012-08-24T17:27:08", "url": "https://files.pythonhosted.org/packages/8c/cb/c497fe88e172b1eb8da011b93011840fcc122c5b62f0a2bc6576ae6b8124/printio-0.0.2.win32.exe" }, { "comment_text": "", "digests": { "md5": "52545a04a25f2ad824bf57165855a449", "sha256": "ae246ea624b6fe6c4d5264ac967edfeca556bbb2c10321b670380d3cb1b425ac" }, "downloads": -1, "filename": "printio-0.0.2.zip", "has_sig": false, "md5_digest": "52545a04a25f2ad824bf57165855a449", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16819, "upload_time": "2012-08-24T17:27:03", "url": "https://files.pythonhosted.org/packages/00/13/ecd786a57df2e5fa0344b94fbe5c5f2cacbc7389e451b6f5c633de6cca41/printio-0.0.2.zip" } ] }