Comments (2)
Hope this helps:
template1 = """
<group>
{{ address_name }} {{ member_count | DIGIT }} address members:
{{ member | ORPHRASE}}
<group name="_">
excluded members: {{ _start_ }}
{{ excludedmembers | ORPHRASE }}
</group>
</group>
"""
parser = ttp(data, template1)
parser.parse()
pprint(parser.result())
# prints:
# [[[{'address_name': 'Any', 'member': '0.0.0.0/0', 'member_count': '1'},
# {'address_name': '1.1.1.1', 'member_count': '0'},
# {'address_name': '192.168.0.224', 'member_count': '0'},
# {'address_name': '2.2.2.0/32', 'member_count': '0'},
# {'address_name': '3.3.3.0/24', 'member_count': '0'},
# {'address_name': 'private_network',
# 'excludedmembers': '4.4.4.0/24, 1.1.1.1-1.1.2.255',
# 'member': '10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16',
# 'member_count': '5'},
# {'address_name': 'test', 'member': '1.1.101.0/24', 'member_count': '1'},
# {'address_name': 'testex', 'member_count': '0'}]]]
need to use groups to properly combine excludedmembers
results, docs for name="_"
from ttp.
excellent!!!
from ttp.
Related Issues (20)
- Hello everyone, how do I parse import_RT and export_RT in the following configuration file using TTP. HOT 1
- Question about parsing non hierarchical data HOT 4
- Config generation from TTP template HOT 1
- Group functions filter out tail match results HOT 2
- Incorrect behavior if text notstartswith '\n' and template with '_end_' indicates
- resuball functions will execution many times HOT 3
- Cannot parse identical keys in different groups HOT 2
- Record multiple variables from a single group? HOT 1
- matching irrelevant group HOT 1
- Using of group.to_int leads to errors HOT 3
- TTP KeyError while running macro HOT 1
- Handling a variable that conditionally appears in output to be parsed? HOT 2
- Add new method to TTP to emit template content HOT 1
- How to correlate/enforce previously matched attribute? HOT 2
- Incorrect "default" behavior in nested groups HOT 6
- Incorrect macro behavior in nested groups HOT 2
- Request: linenumber match function
- The asterisks at the end of the key_name are removed
- \1 in key_value used in group name path_string
- Not closing group match properly when matching lines appear in multiple places in config HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ttp.