Reading a Simple Text File with Python
February 08, 2019
Here's a script to read the contents of a text file.
from sys import argv
script, filename = argv
#open the file and read contents
txt = open(filename)
print txt.read()
print "Read the file again?"
file_again = raw_input("> ")
txt_again = open(file_again)
print txt_again.read()
Recent Entries
- The Rise of Agents in Agentic Coding: Transforming Software Development August 20, 2025
- Bleu de Chanel L'Exclusif August 19, 2025
- CSS Optimization August 19, 2025