{ "info": { "author": "Kanat Bekt", "author_email": "bekt17@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Overview\n\nPyScanner is a Java-like input scanner.\n\nThis is very useful for reading input for programming contests such as ACM ICPC, Topcoder, Google Code Jam, and Facebook Hacker Cup.\n\n# Installation\n\n easy_install PyScanner\n\nAnd then in your python3 module include:\n\n from scanner import Scanner\n\n# Examples\n\nThe following example allows to read a float from stdin:\n```python\n# Input:\n# 3 0.5\nsc = Scanner()\nx = sc.next_int()\ny = sc.next_float()\ntype(x) is int # True\ntype(y) is float # True\nx + y # 3.5\n```\n\nThe following code allows to read until EOF and obtain int types:\n```python\n# Assume input is:\n# 10 20 30\n# 40 50 60\nsc = Scanner()\nsum = 0\nwhile sc.has_next():\n sum += sc.next_int()\nsum # 210\n```\n\nThe default input stream is sys.stdin. However, it is possible to read from a file or even a string:\n```python\nsc = Scanner(file='data.txt')\n# do stuff\nsc.close()\n```\n\n```python\nsc = Scanner(source='some string to use as input')\n```\n\nThe scanner can also use string delimeters other than whitespace.\n```python\nsc = Scanner(delim=',')\n```\n\nBy default, the scanner does a str split. If forced, a regex pattern can also be used. As expected, the latter method is slower:\n```python\ncontent = '1 fish 2.5 fish red fish blue fish\nsc = Scanner(source=content, delim='\\S*fish\\S*', force_regex=True)\nsc.next_int() # 1\nsc.has_next() # True\nsc.next_float() # 2.5\nsc.next() # red\nsc.next() # blue\nsc.has_next() # False\n```\n\n# Usage\nTODO: example using the Scanner vs. standard Python way.\n\n# License\n\n[THE BEER-WARE LICENSE](https://tldrlegal.com/license/beerware-license)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Bekt/PyScanner", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "PyScanner", "package_url": "https://pypi.org/project/PyScanner/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PyScanner/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Bekt/PyScanner" }, "release_url": "https://pypi.org/project/PyScanner/1.0.3/", "requires_dist": null, "requires_python": null, "summary": "Java-like input scanner.", "version": "1.0.3" }, "last_serial": 1669385, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "51a3de595a3b5bc2fa9a9861e01554e0", "sha256": "88f6a3e89f8e98f514090c5f85196cdb07099be912d1f0e25c3a003235bc9327" }, "downloads": -1, "filename": "PyScanner-1.0-py3.3.egg", "has_sig": false, "md5_digest": "51a3de595a3b5bc2fa9a9861e01554e0", "packagetype": "bdist_egg", "python_version": "3.3", "requires_python": null, "size": 5027, "upload_time": "2014-04-20T08:21:58", "url": "https://files.pythonhosted.org/packages/3f/60/539652def554363308d7341a80ac5d5060a2076f2196b423ad6bff1cd571/PyScanner-1.0-py3.3.egg" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "174653cda36861c584c101c5f522354f", "sha256": "bde3555225c4a12fc22885cb5d65a4eea82ef1be0307a70aef799371fcb6d890" }, "downloads": -1, "filename": "PyScanner-1.0.3-py3.3.egg", "has_sig": false, "md5_digest": "174653cda36861c584c101c5f522354f", "packagetype": "bdist_egg", "python_version": "3.3", "requires_python": null, "size": 5848, "upload_time": "2014-04-21T06:59:07", "url": "https://files.pythonhosted.org/packages/ee/50/446a75033832e5d3a3bbc2f20a4fea3cc3de1da5965677563aa440dfe81f/PyScanner-1.0.3-py3.3.egg" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "174653cda36861c584c101c5f522354f", "sha256": "bde3555225c4a12fc22885cb5d65a4eea82ef1be0307a70aef799371fcb6d890" }, "downloads": -1, "filename": "PyScanner-1.0.3-py3.3.egg", "has_sig": false, "md5_digest": "174653cda36861c584c101c5f522354f", "packagetype": "bdist_egg", "python_version": "3.3", "requires_python": null, "size": 5848, "upload_time": "2014-04-21T06:59:07", "url": "https://files.pythonhosted.org/packages/ee/50/446a75033832e5d3a3bbc2f20a4fea3cc3de1da5965677563aa440dfe81f/PyScanner-1.0.3-py3.3.egg" } ] }