From 263daec636e8a53766f629a71696f3768915ced1 Mon Sep 17 00:00:00 2001 From: Lewis Date: Sun, 15 Apr 2012 12:16:03 -0700 Subject: [PATCH] Added examples to README file --- README | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README b/README index 978e531..044b0ef 100644 --- a/README +++ b/README @@ -8,16 +8,24 @@ Installation ============ $ pip install pycksum - $ easy_install pycksum - Examples ===== -.. code-block: python +The simplest way to use pycksum is to just give it a string: + +import pycksum +ck = pycksum.cksum("Any string") - import pycksum - pycksum.cksum("Any string") +You can pass in a file or an iterable: +ck = pycksum.cksum( open("filename")) +ck = pycksum.cksum( ["This", "love", "is", "taking", "its", "toll", "on me"]) +If you have a lot of data to process, it's more memory-efficient to calculate the cksum incrementally: +c = pycksum.Cksum() +for data in input_fd: + c.add(data) +ck = c.get_cksum() +sz = c.get_size()