读取一个文件,打印除以字符#开头的行之外的所有行
with open('test.txt') as f: for line in f.read(): if not line.startswith('#'): print(line)