⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.118
Server IP:
2.57.91.161
Server:
Linux sg-nme-web1518.main-hosting.eu 5.14.0-611.16.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 22 03:40:39 EST 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.3.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
gsutil
/
third_party
/
pyparsing
/
examples
/
View File Name :
builtin_parse_action_demo.py
# # builtin_parse_action_demo.py # Copyright, 2012 - Paul McGuire # # Simple example of using builtin functions as parse actions. # import pyparsing as pp ppc = pp.common # make an expression that will match a list of ints (which # will be converted to actual ints by the parse action attached # to integer) nums = ppc.integer[...] test = "2 54 34 2 211 66 43 2 0" print(test) # try each of these builtins as parse actions for fn in (sum, max, min, len, sorted, reversed, list, tuple, set, any, all): if fn is reversed: # reversed returns an iterator, we really want to show the list of items fn = lambda x: list(reversed(x)) # show how each builtin works as a free-standing parse action print(fn.__name__, nums.set_parse_action(fn).parse_string(test))