TopDl: example3.py
File example3.py, 394 bytes (added by , 12 years ago) |
---|
Line | |
---|---|
1 | #!/usr/bin/env python |
2 | |
3 | import sys |
4 | from deter import topdl |
5 | |
6 | if len(sys.argv) < 2: |
7 | sys.exit('Usage: %s topdl_file' % sys.argv[0]) |
8 | |
9 | top = topdl.topology_from_xml(filename=sys.argv[1], top='experiment') |
10 | |
11 | for i, e in enumerate(top.elements): |
12 | if not isinstance(e, topdl.Computer): continue |
13 | e.set_attribute('computer_number', '%s' % i) |
14 | |
15 | |
16 | print topdl.topology_to_xml(top, top='experiment') |