Where do you specify the .txt file to be used with wordcount exercise?

116 views
Skip to first unread message

Tendaytripper

unread,
Dec 14, 2014, 4:48:17 PM12/14/14
to python-g...@googlegroups.com
I am very new to programming. I completed the list and string exercises with no problem but I do admit to checking their solution to the wordcount.py exercise to guide my solution. I think my code works but where do I specify the .txt file to run the code on? Everything refers to "filename." I have run the code in IDLE and PyCharm. I have also tried to run it through Windows Vista (don't judge) command prompt, but my extremely basic knowledge only got me so far as viewing the files inside the "google-python-exercises" directory.

Please help.

Jimmy Diep

unread,
Feb 5, 2015, 2:55:36 PM2/5/15
to python-g...@googlegroups.com
You should be able to specify any (text) file and it will work.  You may have to modify the 1st line of your python code from
#!/usr/bin/python to #!c:/Python/python.exe or wherever your python executable is.  Afterwards, you should be able to specify the '.txt' file as:

./wordcount.py --count alice.txt
Reply all
Reply to author
Forward
0 new messages