From e79f44bc747032e83f2bcdbe187f0aee7fd53ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gra=C3=B1a?= Date: Wed, 5 Jun 2019 00:37:53 -0300 Subject: [PATCH] Use shorter idiomatic python for README examples --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fb3fe6..db28a24 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ The `jsonpath2.path.Path` class represents a JSONPath. >>> from jsonpath2.path import Path >>> p = Path.parse_str('$["hello"]') ->>> list(map(lambda match_data: match_data.current_value, p.match(d))) +>>> [match_data.current_value for match_data in p.match(d)] ['Hello, world!'] ->>> list(map(lambda match_data: match_data.node.tojsonpath(), p.match(d))) +>>> [match_data.node.tojsonpath() for match_data in p.match(d)] ['$["hello"]'] ``` @@ -130,9 +130,9 @@ The syntax for a function call is the name of the function followed by the argum >>> from jsonpath2.path import Path >>> p = Path.parse_str('$["hello"][length()]') ->>> list(map(lambda match_data: match_data.current_value, p.match(d))) +>>> [m.current_value for m in p.match(d)] [13] ->>> list(map(lambda match_data: match_data.node.tojsonpath(), p.match(d))) +>>> [m.node.tojsonpath() for m in p.match(d)] ['$["hello"][length()]'] ```