22 lines
520 B
Python
22 lines
520 B
Python
import sys
|
|
|
|
def erase_commented_lines(filename, out):
|
|
with open(filename, 'r') as file:
|
|
lines = file.readlines()
|
|
|
|
# gcc leaves these "comments" at the start of the file
|
|
lines = [line for line in lines if not line.startswith('#')]
|
|
|
|
with open(out, 'w') as file:
|
|
file.writelines(lines)
|
|
|
|
def main():
|
|
if len(sys.argv) != 3:
|
|
print(f'Usage: python3 {sys.argv[0]} <in> <out>')
|
|
return
|
|
|
|
erase_commented_lines(sys.argv[1], sys.argv[2])
|
|
|
|
if __name__ == '__main__':
|
|
main()
|