Skip to content

Commit

Permalink
Added examples to README file
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis committed Apr 15, 2012
1 parent fc9e390 commit 263daec
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions README
Expand Up @@ -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()

0 comments on commit 263daec

Please sign in to comment.