Python script that make my .bash_aliases file MUCH more readable and clear My .bash_aliases file contains several aliases.
In the beginning, when I wanted to see the aliases, I print the .bash_aliases file,
The output wasn't readable at all, so I created a python script to make it better.
To call my python script, I use the alias print_aliases_manual
What is the most pythonic way to write the following script?
Here is my python script:

class bcolors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'


with open('/home/pi/.bash_aliases', 'r') as f:
    lines = f.readlines()

    for line in lines:
        if r'##' in line:
            print(f'{bcolors.HEADER}{bcolors.UNDERLINE}{bcolors.BOLD}{line}{bcolors.ENDC}')
        elif r'#' in line:
            print(f'{bcolors.WARNING}{line}{bcolors.ENDC}')
        elif r'alias' in line:
            drop_alias = line.replace('alias', '')
            new_line = drop_alias.replace('=', '   ')
            print(f'{bcolors.OKGREEN}{new_line}')
        else:
            print(f'{line}')

Here is my bash_aliases file:
### Aliases list divided by category:

## General commands:
alias cdd=&quot;cd /home/pi/Desktop/speedboat/&quot;
alias dc=&quot;sudo docker-compose&quot;
alias pm2=&quot;sudo pm2&quot;

## Cellular related commands:
alias pc=&quot;ping -I wwan0 www.google.com&quot;
alias qmi=&quot;sudo qmicli -d /dev/cdc-wdm0 -p&quot;

## AWS relaeted commands:
alias dlogs=&quot;sudo docker logs -f iot_service&quot;

## Git commands:
alias gp=&quot;sudo git pull&quot;
alias gc=&quot;sudo git checkout&quot;

## scripts to run when deleting speedboat directory is needed:

# copying files to Desktop
alias stodtop=&quot;sudo -E sh /home/pi/Desktop/speedboat/scripts/copy_files_to_desktop.sh&quot;
# copying files from Desktop
alias sfromdtop=&quot;sudo -E sh /home/pi/Desktop/speedboat/scripts/copy_files_from_desktop_to_speedboat.sh&quot;

## verifications test and updates scripts
# run speedboat verifications tests
alias sinsta=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/installation_verification.sh&quot;
# run local unittests
alias slocalt=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/run_local_unittest.sh&quot;
# pull os updates from git and execute
alias supdate=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/updates-speedboat.sh&quot;

## speedboat start and stop scripts (dockers and PM2)
alias startr=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/start_speedboat.sh&quot;

alias stopr=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/stop_speedboat.sh&quot;

## AWS related scripts:

alias secrl=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/ecr-login.sh&quot;

alias slog=&quot;sudo sh /home/pi/Desktop/speedboat/scripts/log_register.sh&quot;

## Command to run speedboat aliases manual:
alias print_aliases_manual=&quot;python3 /home/pi/Desktop/speedboat/verification/test_verification_speedboat/colored_aliases_manual.py&quot;
print
f-Strings are a great and convenient tool for including variables and calculations in strings. I'd say they're generally not needed when printing only variables. For example
print(f'{bcolors.WARNING}{line}{bcolors.ENDC}')

could become
print(bcolors.WARNING, line, bcolors.ENDC, sep='')

However I'm not sure which of the two is more pythonic, I personally prefer the latter for readability.
You could also consider pulling out formatting into seperate variables to increase readability.
HEADER_FORMAT = &quot;&quot;.join((bcolors.HEADER, bcolors.UNDERLINE, bcolors.BOLD, &quot;{}&quot;, bcolors.ENDC))

print(HEADER_FORMAT.format(line))


in vs. startswith
I'd recommend using str.startswith instead of str in str for checking prefixes.
if r'##' in line:

becomes
if line.startswith(r&quot;##&quot;):

This is less error-prone and conveys your intentions more explicitly, without the need to look at the source file. As there aren't any escape characters in your prefixes, you also don't need to make it a raw string. You can simply drop the r:
if line.startswith(&quot;##&quot;):