import re


def remove_comments(codelines):
    """ Removes all comments from codelines. """

    lines_removed = []
    for l in codelines:

        # remove comments
        lines_removed.append(re.sub("#.*", "", l))

    return lines_removed