Skip to content

Commit 99402a6

Browse files
committed
Update readme to be Python 3 compatible (#56)
1 parent 189e431 commit 99402a6

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

README.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ Getting started
3535

3636
It's very simple to start using the `humanfriendly` package::
3737

38-
>>> import humanfriendly
39-
>>> user_input = raw_input("Enter a readable file size: ")
40-
Enter a readable file size: 16G
41-
>>> num_bytes = humanfriendly.parse_size(user_input)
42-
>>> print num_bytes
38+
>>> from humanfriendly import format_size, parse_size
39+
>>> from humanfriendly.prompts import prompt_for_input
40+
>>> user_input = prompt_for_input("Enter a readable file size: ")
41+
42+
Enter a readable file size: 16G
43+
44+
>>> num_bytes = parse_size(user_input)
45+
>>> print(num_bytes)
4346
16000000000
44-
>>> print "You entered:", humanfriendly.format_size(num_bytes)
47+
>>> print("You entered:", format_size(num_bytes))
4548
You entered: 16 GB
46-
>>> print "You entered:", humanfriendly.format_size(num_bytes, binary=True)
49+
>>> print("You entered:", format_size(num_bytes, binary=True))
4750
You entered: 14.9 GiB
4851

4952
Command line

0 commit comments

Comments
 (0)