Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
#!/usr/bin/env python3 | |
import re | |
import sys | |
import zlib | |
def main(filename:str): | |
"""This script will find each FlateDecode stream in the given PDF document using a regular expression, unzip it, and print out the unzipped data.""" | |
with open(filename, 'rb') as pdf_file: |
""" | |
This is a pure Python3 implementation of the K-means Clustering algorithm. | |
It is based on a GitHub Gist which uses Python2: | |
https://gist.github.com/iandanforth/5862470 | |
I have refactored the code and to assure the code obeys Python Enhancement Proposals (PEPs) rules. | |
After reading through this code you should understand clearly how K-means works. | |
This script specifically avoids using numpy or other more obscure libraries. | |
It is meant to be *clear* not fast. | |
I have also added integration with the plot.ly plotting library. | |
So you can see the clusters found by this algorithm. To install plotly run: |