from typing import TextIO, Iterator

def remove_after_hash(s: str) -> str:
    return s.split('#', 1)[0]

def extract_data(file: TextIO) -> Iterator[str]:
    for line in file:
        line = remove_after_hash(line)
        yield line

if __name__ == '__main__':
    a = [0.0] * 4
    typ = (int, float, float, int)
    with open('sample.txt') as f:
        num, *a[1:3], ns = map(lambda t, i: t(i), typ, extract_data(f))

    print(num)
    print(a[1])
    print(a[2])
    print(ns)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: