I am new to programming in Python and wanted help writing a python program that prints number of characters, words and lines in a file. For example say the name of the file is time.txt
Asked
Active
Viewed 64 times
1 Answers
0
You have to learn about work with files in python.
https://docs.python.org/2/tutorial/inputoutput.html - python v. 2.*
https://docs.python.org/3/tutorial/inputoutput.html - python v. 3.*
This part of documentation will help you:
with open('time.txt', 'wb') as f:
f.write('sometext')
f.write(some_string_variable)
with open('time.txt', 'rb') as f:
s = f.getlines()
And, next time - search info about your problem first - it can be already solved.

Jefferson Houp
- 858
- 1
- 7
- 17