AM I DOING THIS RIGHT, PLEASE HELP ME, SO ME MORE EXAMPLES ON HOW TO RIGHT IT :o

C:\home\COP1000\a\3>python wc.py futval.py test.txt wc.py
22 103 699 futval.py
2 4 22 test.txt
52 223 1683 wc.py
76 330 2404 total

You got to show us the code for wc.py. Most of us are not very good in mind reading!

So I Didnt Do This Right

I got to know what you have been asked to do with your Python program, before I can tell you if you did it right!

Word Count. A Common Utility On Unix/linux Systems Is A Small Program Called "wc." This Program Analyzes A File To Determine The Number Of Lines, Words, And Characters Contained Therein. Write A Version Of Wc. The Program Should Accept A File Name As Input And Than Print Three Numbers Showing The Count Of Lines, Words, And Characters In The File.

there is spaces between the numbers

Here is simplified approach, the number of new-line characters '\n' give number of lines, the number of spaces are approximately the number of words, and the number of characters is the length of the text string read from file.

You simply use a for loop and and iterate each character in text counting new-lines, spaces. Don't have Unix and don't know if space counts as a character, also new-line. Can use char_from_text.isalnum() to weed these out.

You can also use, I didn't test, number_of_lines = text.count('\n') function.

A more correct answer for the number of words can be obtained by splitting the text string into list of words with word_list = text.split() and then get length of this list with number_words = len(word_list).

so how would i set this up with what u told me because im a visual learner
C:\home\COP1000\a\3>python wc.py futval.py test.txt wc.py
22 103 699 futval.py
2 4 22 test.txt
52 223 1683 wc.py
76 330 2404 total

Here is simplified approach, the number of new-line characters '\n' give number of lines, the number of spaces are approximately the number of words, and the number of characters is the length of the text string read from file.

You simply use a for loop and and iterate each character in text counting new-lines, spaces. Don't have Unix and don't know if space counts as a character, also new-line. Can use char_from_text.isalnum() to weed these out.

You can also use, I didn't test, number_of_lines = text.count('\n') function.

A more correct answer for the number of words can be obtained by splitting the text string into list of words with word_list = text.split() and then get length of this list with number_words = len(word_list).
i having problem using this set up, can u please help me
C:\home\COP1000\a\3>python wc.py futval.py test.txt wc.py
22 103 699 futval.py
2 4 22 test.txt
52 223 1683 wc.py
76 330 2404 total

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.