why python module requests_html is canceling bold and underline effects after import from string in output only?

111 views Asked by At

so i have this code.

just some ansi escape codes for red, bold, underlined and endc. the code is printing on the screen a modified string.

bold = "\033[1m"
underlined = "\033[4m"
red = "\033[91m"
endc = "\033[0m"

def red_bold_underlined(string):
    return bold + underlined + red + string + endc

x = red_bold_underlined('stackoverflow question')
print(x)
print(x.__repr__())

# pip install requests_html
from requests_html import HTMLSession

print()
print(x)
print(x.__repr__())

output from code https://i.stack.imgur.com/KMNh5.jpg

if i comment the line: from requests_html import HTMLSession

output with commented line https://i.stack.imgur.com/fjMtt.jpg

also, in these images under the every output is the representation version of the string and it is the SAME for every situation, but the problem is that i dont understand what requests_html has inside because it is canceling the bold and underline effects after the import.

i also tried other modules, but this happens only when i import requests_html or import something from requests_html.

my question is: how do i fix the code or the problem in order to output the bold and underline effects on the terminal and also import requests_html module in the code?

0

There are 0 answers