Advertisement
JPablos

archivo_79. Simple. Python

May 29th, 2022 (edited)
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. # -*- coding: utf-8 -*-
  4.  
  5. # =========================================================================
  6. # Más información
  7. # https://docs.python.org/es/3.8/library/textwrap.html#textwrap.TextWrapper
  8. # ==========================================================================
  9. """
  10. Spyder Editor
  11.  
  12. Este programa lee un `archivo.txt` y lo imprime en líneas de 79 caracteres.
  13. """
  14. import os
  15. import textwrap
  16.  
  17. name = input('Nombre del archivo: ')
  18.  
  19. f = open(name, 'r')
  20.  
  21. for line in f:
  22.     print((textwrap.fill(line.strip(), width=79)))
  23.  
  24. f.close()
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement