-5

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

  • Possible duplicate of [How to read a file line by line into a list with Python](http://stackoverflow.com/questions/3277503/how-to-read-a-file-line-by-line-into-a-list-with-python) – Tim B Jun 25 '16 at 09:59

1 Answers1

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