Wednesday, 3 July 2024

Print hidden characters of a string in python

When you do

result = subprocess.run(
        args,
        capture_output=True,
        text=True
    )



    for line in result.stdout.splitlines():
        print(line)

There can be hidden text, which is then not printed. To show it, wrap the line with a list. I found this out by processing log lines and trying to write a regex.

result = subprocess.run(
        args,
        capture_output=True,
        text=True
    )



    for line in result.stdout.splitlines():
        print([line])

No comments:

Post a Comment

Parse Wikipedia dump

""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...