{ "info": { "author": "Thomas Aglassinger", "author_email": "roskakori@users.sourceforge.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing" ], "description": "csv342\n======\n\ncsv342 is a Python module similar to the the csv module in the standard\nlibrary. Under Python 3, it just calls the standard csv module. Under\nPython 2, it provides a Python 3 like interface to reading and writing CSV\nfiles, in particular concerning non ASCII characters.\n\nIt is distributed under the BSD license. The source code is available from\nhttps://github.com/roskakori/csv342.\n\n\nInstallation\n------------\n\nTo install, simply run::\n\n $ pip install --upgrade csv342\n\nAlternatively you can download the distributin archive from\nhttp://pypi.python.org/pypi/csv342/, unpack it and copy ``csv342.py`` into\nyour application path.\n\n\nExamples\n--------\n\nFirst, consider changing all string literals in you source code to\n``unicode`` instead of ``str`` under Python 2 using to avoid the\nmessy ``u`` string prefix.\n\n>>> from __future__ import unicode_literals\n\nThe following examples assume you did that, making your Python 2 code look\nlike Python 3 even more.\n\nOnce you import ``csv342`` using\n\n>>> import csv342 as csv\n\nyour code can call CSV functions the same way independent of whether it runs\nunder Python 2 or 3. First, let's write a few test data to a ``io.StringIO``:\n\n>>> import io\n>>> csv_stream = io.StringIO()\n>>> csv_writer = csv.writer(csv_stream)\n>>> csv_writer.writerow(['a', 'b'])\n>>> csv_writer.writerow(['1', '\"x\"'])\n>>> csv_content = csv_stream.getvalue()\n>>> str(csv_content)\n'a,b\\r\\n1,\"\"\"x\"\"\"\\r\\n'\n\nTo read data from a ``io.StringIO`` use:\n\n>>> csv_stream = io.StringIO('a,b\\r\\n1,\"\"\"x\"\"\"\\r\\n')\n>>> csv_reader = csv.reader(csv_stream)\n>>> for row in csv_reader:\n>>> print(row)\n\n\nTo read a UTF-8 encoded CSV file with non ASCII characters use:\n\n>>> csv_path = os.path.join('test', 'utf-8.csv')\n>>> with io.open(csv_path, encoding='utf-8', newline='') as csv_file:\n>>> csv_reader = csv.reader(csv_file, delimiter=',')\n>>> for row in csv_reader:\n>>> print('row {0:d}: data={1}'.format(csv_reader.line_num, row))\n\n\nFeatures\n--------\n\n* Supports Python 2's ``unicode`` strings.\n* Provides ``reader``, ``writer``, ``DictReader`` and ``DictWriter``.\n* Supports reading and writing with files, ``io.StringIO`` etc.\n* Rejects attempts to read or write with ``cStringIO`` or\n ``StringIO.StringIO`` (which do not really work with ``unicode``);\n use ``io.StringIO`` instead.\n\n\nLimitations\n-----------\n\n* All limitations of the standard ``csv`` module apply.\n* Uses the standard ``csv.Sniffer`` under Python 2.\n* Requires Python 2.6 or later.\n\n\nPerformance\n-----------\n\nProcessing a CSV with Python 2 using ``csv342`` is about 30% slower than\nprocessing it with Python 3. This is probably due the fact that under Python\n2 there is an intermediate translation to UTF-8 using pure Python code while\nin Python 3 uses mostly native code.\n\nProvided you have both Python 2 and 3 installed on the same machine, you can\ntest this yourself running::\n\n python3 test/performance.py\n python2 test/performance.py\n\nOn an ancient laptop with a core 2 duo Intel CPU and Ubuntu 14.04, this takes\n10.2 seconds respectively 13.6 seconds.\n\n\nLicense\n-------\n\nCopyright (c) 2016-2018, Thomas Aglassinger\nAll rights reserved.\n\nDistributed under the BSD License. For more information, see LICENSE.txt.\n\n\nVersion history\n---------------\n\nVersion 1.0.0, 2018-04-02\n* Fixed ``DictReader`` so that it can now read from a list of lines\n (`issue #1 `_, contributed by\n Lucas Wiman).\n* Fixed ``AttributeError`` in ``StringIO`` test (contributed by Lucas Wiman).\n\nVersion 0.2, 2016-04-17\n* Fixed version number when running under Python 3.\n* Fixed helper constant ``IS_PYHTON2`` which always was ``False``.\n* Added remaining symbols from Python 2's ``csv`` module.\n\nVersion 0.1, 2016-04-16\n* Initial release.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/csv342/", "keywords": "csv", "license": "GNU Lesser General Public License 3 or later", "maintainer": "", "maintainer_email": "", "name": "csv342", "package_url": "https://pypi.org/project/csv342/", "platform": "", "project_url": "https://pypi.org/project/csv342/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/csv342/" }, "release_url": "https://pypi.org/project/csv342/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Python 3 like CSV module for Python 2", "version": "1.0.0" }, "last_serial": 3725854, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c2fd7882deb1f7adc614e6bac5f789c2", "sha256": "92a47c6ba88d4d2aeb9aca30cc80625a161b312cfdf381866613c39fe7e8f9db" }, "downloads": -1, "filename": "csv342-0.1.zip", "has_sig": false, "md5_digest": "c2fd7882deb1f7adc614e6bac5f789c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12928, "upload_time": "2016-04-16T09:59:19", "url": "https://files.pythonhosted.org/packages/56/d8/cef9109547daedd97d00bde181196fe267840a608319abacee9295f63079/csv342-0.1.zip" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "809a22094b5a6bb67c5d439379a18438", "sha256": "21db71f45c10efd47b69be6c97b49f898ac72ada6c5e48f55039bd869aa33cc0" }, "downloads": -1, "filename": "csv342-0.2.zip", "has_sig": false, "md5_digest": "809a22094b5a6bb67c5d439379a18438", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13317, "upload_time": "2016-04-17T10:31:53", "url": "https://files.pythonhosted.org/packages/41/79/d45bdbbc261f461e938f5d463aff4e06b8308b9b72be04ec5717c92207e5/csv342-0.2.zip" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "352db483179c53070c1ce5f00d1ce697", "sha256": "670a76070df25ba7217cfc2c535e7fd8b61ea85ba4b27ab6cdfdc0c9f8d92c05" }, "downloads": -1, "filename": "csv342-1.0.0.zip", "has_sig": false, "md5_digest": "352db483179c53070c1ce5f00d1ce697", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13704, "upload_time": "2018-04-02T09:26:46", "url": "https://files.pythonhosted.org/packages/e4/1b/fdd1d22a66ff67753874b0b1be4124e0944d7c795d6ab58d4fe9027d4eba/csv342-1.0.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "352db483179c53070c1ce5f00d1ce697", "sha256": "670a76070df25ba7217cfc2c535e7fd8b61ea85ba4b27ab6cdfdc0c9f8d92c05" }, "downloads": -1, "filename": "csv342-1.0.0.zip", "has_sig": false, "md5_digest": "352db483179c53070c1ce5f00d1ce697", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13704, "upload_time": "2018-04-02T09:26:46", "url": "https://files.pythonhosted.org/packages/e4/1b/fdd1d22a66ff67753874b0b1be4124e0944d7c795d6ab58d4fe9027d4eba/csv342-1.0.0.zip" } ] }