Python PLY Parser: How to prevent the parsed result from getting printed to stdout?

20 Views Asked by At

I am using PLY parser to parse a large file.

if __name__ == '__main__':
    print("Reading big file",bigfile)
    try:
        full_file = gzip.open(bigfile, mode='rt').read()
    except IOError:
        full_file = open(bigfile).read()
    result = parser.parse(full_file, lexer=lexer, debug=False)

When I run the above code, the result is getting printed out to stdout. How do I suppress this? I use result later in the program to do something else, I don't need to see it printed out to the screen. Really appreciate any help here.

0

There are 0 best solutions below