ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/learning/Mark/mymod.py
Revision: 591
Committed: Tue Nov 3 22:45:12 2015 UTC (10 years, 4 months ago) by nino.borges
Content type: text/x-python
File size: 539 byte(s)
Log Message:
Moved dir out of main dir.

File Contents

# User Rev Content
1 ninoborges 8
2    
3     import os
4    
5     def CountLines(fileObj):
6     fileObj.seek(0)
7     contents = fileObj.readlines()
8     return len(contents)
9    
10    
11     def CountChars(fileObj):
12     fileObj.seek(0)
13     contents = fileObj.read()
14     return len(contents)
15    
16     if __name__ == '__main__':
17     inputFile = open(r"C:\Documents and Settings\eaborges\Desktop\Working\readme.txt",'r')
18     numbLinesFound = CountLines(inputFile)
19     numbCharsFound = CountChars(inputFile)
20     print "This file contains %d lines and %d characters"% (numbLinesFound, numbCharsFound)