{ "info": { "author": "Md. Jahidul Hamid", "author_email": "jahidulhamid@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Filters" ], "description": "[![Build Status](https://travis-ci.org/neurobin/rcslice.svg?branch=release)](https://travis-ci.org/neurobin/rcslice)\n\n\nThis package provides Python module to slice a list of sliceables (1 indexed, both start and end index are inclusive). Helps to slice file content line by line or column by column or a combination of both.\n\n# Install\n\nInstall from Pypi:\n\n```bash\npip install rcslice\n```\n\n# Usage\n\n```python\nfrom rcslice import RowSlice\n\nrs = RowSlice()\n\nlist_of_sliceables = rs.slice(list_of_sliceables, '1-2,2.4-4.5,8-2.6')\n\n```\n\n# Slicing syntax\n\nBelow, r is the row number, and c is the column number. All indexes are inclusive and 1 indexed.\n\n r.c-r.c\n r.c-r.c,r.c-r.c,...\n .c-.c [not specifying both r means slice on every row for the columns]\n 1.c-.c [not specifying r means the last row when another r is specified]\n .c-1 [last row.c to first row, reversion]\n r [only r'th row]\n r1-r2 [when both r is not the same, not specifying c means the first c for start index and last c for end index]\n r1-r2.c [first c of r1 to r2.c]\n r1.c-r2 [r1.c to last c of r2]\n r-r.c [when both r is the same, not specifying one c will mean the last c]\n r-r [when both r is the same, not specifying both c means the first c for start index and last c for end index]\n e.c-e.c [e means last row]\n e-e [last row]\n e-e.c [last c of e to e.c]\n e.c-e [e.c to last c of e]\n e.e-e.e [same as e-e, e in column is stripped off]\n\nThe e to specify the last row is exclusively for row only. Do keep in mind that the class name is RowSlice. It gives special priority on row and not just with the special character e. You will see some major difference in how r and c works in above syntax explanation.\n\nFor multiple slice syntax `r.c-r.c,r.c-r.c,...`, a separator will be inserted between each slice. You can set the separator by passing it during class object instantiation:\n\n```python\nrs = RowSlice(['I am a separator'])\n```\n\nThis separator is also a **list** of something.\n\n\n# Examples\n\nAn example of slicing a file content read by `readlines()`:\n\n```python\n\nimport os\nfrom rcslice import RowSlice\n\ndef get_file_lines(filename):\n content = []\n try:\n with open(os.path.join(os.path.dirname(__file__), filename), 'r') as f:\n content = f.readlines()\n except OSError as e:\n raise\n return content\n\n\nrs = RowSlice(['','']) # ['',''] will add 2 new lines for multi slice syntax (e.g 1-2,3-4,...)\n\nlist_of_lines = get_file_lines('test.txt')\n\nprint(\"before: \", list_of_lines)\n\nlist_of_lines = rs.slice(list_of_lines, '1-2,1.2-4.5,3.4-1.3,.4-.9')\n\nprint(\"after: \", list_of_lines)\n\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/neurobin/rcslice", "keywords": "slice list sliceable line slice from file", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "rcslice", "package_url": "https://pypi.org/project/rcslice/", "platform": "", "project_url": "https://pypi.org/project/rcslice/", "project_urls": { "Homepage": "https://github.com/neurobin/rcslice" }, "release_url": "https://pypi.org/project/rcslice/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "Slice a list of sliceables (1 indexed, start and end index both are inclusive)", "version": "1.1.0" }, "last_serial": 4316060, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ee7f9dba339f2f8cb5dbd87a90dd5653", "sha256": "7e8828f33b23c9c87e32e8dcba9cabd0156108525bcc8ff95a7087a3b9bc1344" }, "downloads": -1, "filename": "rcslice-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee7f9dba339f2f8cb5dbd87a90dd5653", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4464, "upload_time": "2018-09-26T12:53:05", "url": "https://files.pythonhosted.org/packages/b7/d4/c45f2f7bb4482f86b43b50c37994e39d534e93749b9ce823783fa2a89d8b/rcslice-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1951575e8ad675062be489cadcd3b15", "sha256": "828e46508446d8ac380ef25e13214bd902ae24bf94b58a634d7ec9d9a3dbd8f2" }, "downloads": -1, "filename": "rcslice-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f1951575e8ad675062be489cadcd3b15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3896, "upload_time": "2018-09-26T12:53:08", "url": "https://files.pythonhosted.org/packages/ca/8c/15cb589fc56d85deff1c4ccb01aecf33ada08b9eae055b2705a64ebe0eac/rcslice-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0adcae0e52de4544bc6085e6695a87c1", "sha256": "25bc3b13443768c8fda77156d45665dadcd7a0dc362bbfc81e64e0a7892fa394" }, "downloads": -1, "filename": "rcslice-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0adcae0e52de4544bc6085e6695a87c1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4602, "upload_time": "2018-09-26T14:29:50", "url": "https://files.pythonhosted.org/packages/b2/b8/083c3502876d7ae7f9127398a5e4c1a85a2fc47c5df3cc634d054b78f259/rcslice-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b376bf4301dbc3bf461970a6383fa3c9", "sha256": "76a32b6bbe34da136d7539dae7f5e4872e8f48ed8541c97860a7ae83a253100a" }, "downloads": -1, "filename": "rcslice-1.0.1.tar.gz", "has_sig": false, "md5_digest": "b376bf4301dbc3bf461970a6383fa3c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4024, "upload_time": "2018-09-26T14:29:52", "url": "https://files.pythonhosted.org/packages/d6/e0/11e5a9fe1de7615107853ae29ca951ef9b6a354a886186376cf792eed063/rcslice-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "faef6a2d99fdcec5e5484422613d9fd6", "sha256": "1b12fc0c0ca452e8a9fd2b56ac008162f19e250906a4290a7e7a98be3200c2a6" }, "downloads": -1, "filename": "rcslice-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "faef6a2d99fdcec5e5484422613d9fd6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5180, "upload_time": "2018-09-27T12:44:05", "url": "https://files.pythonhosted.org/packages/aa/96/7935186fba032312eb8a75e6503440b0e6de76c901421f791408e4debd93/rcslice-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f7eb60b25181b14ee8cc54996bdc3c99", "sha256": "a2ce70a60690eb63e52b722e046b334c3aaec5e900b28578f529878782ee5c6e" }, "downloads": -1, "filename": "rcslice-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f7eb60b25181b14ee8cc54996bdc3c99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4414, "upload_time": "2018-09-27T12:44:06", "url": "https://files.pythonhosted.org/packages/53/3e/abe47d91d5340b77b003baf96fdf8966c946eb4c5a704a844b5d03e6e578/rcslice-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "faef6a2d99fdcec5e5484422613d9fd6", "sha256": "1b12fc0c0ca452e8a9fd2b56ac008162f19e250906a4290a7e7a98be3200c2a6" }, "downloads": -1, "filename": "rcslice-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "faef6a2d99fdcec5e5484422613d9fd6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5180, "upload_time": "2018-09-27T12:44:05", "url": "https://files.pythonhosted.org/packages/aa/96/7935186fba032312eb8a75e6503440b0e6de76c901421f791408e4debd93/rcslice-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f7eb60b25181b14ee8cc54996bdc3c99", "sha256": "a2ce70a60690eb63e52b722e046b334c3aaec5e900b28578f529878782ee5c6e" }, "downloads": -1, "filename": "rcslice-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f7eb60b25181b14ee8cc54996bdc3c99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4414, "upload_time": "2018-09-27T12:44:06", "url": "https://files.pythonhosted.org/packages/53/3e/abe47d91d5340b77b003baf96fdf8966c946eb4c5a704a844b5d03e6e578/rcslice-1.1.0.tar.gz" } ] }