diff --git a/book/ch03.rst b/book/ch03.rst index 0f1905b9..cf7d3d86 100644 --- a/book/ch03.rst +++ b/book/ch03.rst @@ -2259,6 +2259,7 @@ must be called with exactly the same number of arguments. Arguments to ``format()`` are consumed left to right, and any superfluous arguments are simply ignored. + >>> '{} wants a {}'.format ('Lee', 'sandwich', 'for lunch') 'Lee wants a sandwich' diff --git a/book/ch07.rst b/book/ch07.rst index e8ec52e1..bf602836 100644 --- a/book/ch07.rst +++ b/book/ch07.rst @@ -1177,7 +1177,7 @@ The listing in code-traverse_ demonstrates this. traverse(child) print(')', end=" ") - >>> t = nltk.Tree('(S (NP Alice) (VP chased (NP the rabbit)))') + >>> t = nltk.Tree.fromstring('(S (NP Alice) (VP chased (NP the rabbit)))') >>> traverse(t) ( S ( NP Alice ) ( VP chased ( NP the rabbit ) ) )