Skip to content

1st assignment of the course "Python in the Enterprise"

Notifications You must be signed in to change notification settings

mark91m12/PitE-MyWordCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyWordCounter

Build Status Coverage Status HitCount

MyWordCounter is an implementation of the Linux program WC (Word Counter)

This is the first task of the course "Python in the Enterprise", as requested have been implemented the following functions :

  • count_lines
  • count_words
  • count_characters

Requirements

In order to run the program you only need to install python 3.6.

Usage

the execution of the program is quite simple, just run the following command inside the folder where the file MyWordCounter.py is located followed by one of the functions (optional) and obviously the file's path (or simply the filename if this one is located in the same folder of the program).

$ python3 myWC.py [option] <filename>

Possible options :

output : number of lines inside the file

$ python3 myWC.py -l <filename>

output : number of words inside the file

$ python3 myWC.py -w <filename>

output : number of characters inside the file

$ python3 myWC.py -c <filename>

IF NO OPTION IS INDICATED ALL COUNTS WILL BE PRINTED IN THIS ORDER

lines number - words number - characters number

IN CASE OF NO FILE THE PROGRAM READ STANDARD INPUT

to terminate the std input press CTRL+D

Example

In this example we can see the results when no file is indicated as input and it's choosed the option -w (number of words)

$ python3 myWC.py -w
hello this is an example
press ctrl+D to close the standard input
12
$ _

Author

About

1st assignment of the course "Python in the Enterprise"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages