Created
July 31, 2018 13:22
-
-
Save sgobin/bfead375e5d8324a56b3530f72870aba to your computer and use it in GitHub Desktop.
Remove empty and only spaces lines from a file / Remove linhas vazias de um arquivo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Limpa linhas em branco dos arquivos | |
with open('5.txt') as infile, open('limpo-5.txt', 'w') as outfile: | |
for line in infile: | |
if not line.strip(): continue # pula linha em branco | |
outfile.write(line) # escreve linha no novo arquivo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment