mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-06 09:07:13 -04:00
port-jobs: Added script for removal of blank lines
Former-commit-id: 207f3b35f60accf85eecbd03e1fd12d914478388 Former-commit-id: 61ea79b06c1af0c70fd7cb3d1b4a6696944ca9fe
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
from os import listdir
|
||||
|
||||
# loop through all Python files in the working directory
|
||||
for filename in listdir('working'):
|
||||
if filename.endswith('.py'):
|
||||
filepath = 'working/' + filename
|
||||
# read input file
|
||||
with open(filepath, 'r') as file:
|
||||
new_file = []
|
||||
for line in file:
|
||||
# remove blank lines
|
||||
if line != '\n':
|
||||
new_file.append(line)
|
||||
# write the updated file contents
|
||||
open(filepath, 'w').writelines(new_file)
|
||||
Reference in New Issue
Block a user