Easily read a text file using counting numbers.
linescan.py
is a simple module designed to aid beginner programmers who need to read data from text files but have trouble setting up open()
or translating real numbers to counting numbers.
- Uses counting numbers to denote line numbers instead of zero-based indexing
- Simple API
- Supports
>=
Python 3.6
import linescan
# Scan a single line using UTF-8 encoding
linescan.scan("MyFile.txt", 12, 12, encoding="utf-8")
# Scan multiple lines using default encoding
linescan.scan("MyFile.txt", 1, 12)
# Scan entire file
linescan.scan("MyFile.txt", 1)
# Passing a value of `True` will raise Exceptions instead of returning `False`
# Pass a value of `False` to restore default behavior
linescan.show_errors(True)
Complete API documentation is available on the wiki.
2013-2018 Caleb Ely