Advertisement
am_dot_com

IA20211025

Oct 25th, 2021 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import sys
  2. """
  3. python 4.py "fich.txt"
  4. sys.argv = ["4.py"]@0, "fich.txt"@1]
  5. """
  6. #print (sys.argv)
  7. FILE_ADDRESS = 1
  8. strFileNameToDisplay = sys.argv[FILE_ADDRESS]
  9.  
  10. strPrefix = strSufix = "_.-^-."*5
  11. try:
  12. fr = open(strFileNameToDisplay, "rt")
  13. strTheFileContents = fr.read()
  14. fr.close()
  15. except:
  16. strTheFileContents = "could not open file for reading"
  17. pass
  18.  
  19. strFormat = "{} {} {}".\
  20. format(strPrefix, strFileNameToDisplay,strSufix)
  21. print (strFormat)
  22. print (strTheFileContents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement