Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
Ok I'm now totally stuck. This is the code: --- import os from collections import Counter path = ":c\\mypath\dir" dirs = os.listdir( path ) filenames = {"this.txt", "that.txt", "the_other.txt","this.doc","that.doc","this.pdf","first.txt","that.pdf"} extensions = [] for filename in filenames:

Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
kl. 16:56:29 UTC+2 torsdag 6. september 2012 skrev Tigerstyle følgende: > Hi guys, > > > > I'm trying to write a module containing a function to examine the contents of > the current working directory and print out a count of how many files have > each exte

Re: Function for examine content of directory

2012-09-06 Thread Tigerstyle
Thanks, just what I was looking for :-) T kl. 17:20:27 UTC+2 torsdag 6. september 2012 skrev MRAB følgende: > On 06/09/2012 15:56, Tigerstyle wrote: > > > Hi guys, > > > > > > I'm trying to write a module containing a function to examine the contents >

Function for examine content of directory

2012-09-06 Thread Tigerstyle
Hi guys, I'm trying to write a module containing a function to examine the contents of the current working directory and print out a count of how many files have each extension (".txt", ".doc", etc.) This is the code so far: -- import os path = "v:\\workspace\\Python2_Homework03\\src\\" dirs

Re: Unittest - testing for filenames and filesize

2012-08-26 Thread Tigerstyle
Ahh, thank you very much Rob. Fixed now. Have a great day. T kl. 19:51:54 UTC+2 søndag 26. august 2012 skrev Rob Day følgende: > On Sun, 2012-08-26 at 10:36 -0700, Tigerstyle wrote: > > > self.assertEqual(statinfo.st_size, filesize) > > > >

Re: Unittest - testing for filenames and filesize

2012-08-26 Thread Tigerstyle
al(statinfo.st_size, filesize) I'm still getting AssertionError and the error says: 100 !=b' Help appreciated. T kl. 21:04:54 UTC+2 fredag 24. august 2012 skrev Robert Day følgende: > On Fri, 2012-08-24 at 09:20 -0700, Tigerstyle wrote: > > > > > def test_3

Re: Unittest - testing for filenames and filesize

2012-08-24 Thread Tigerstyle
Thank you guys, Roy and Terry. I has been great help. I still need some help. Here is the updated code: Demostration of setUp and tearDown. The tests do not actually test anything - this is a demo. """ import unittest import tempfile import shutil import glob import os class FileTest(unittest.

Unittest - testing for filenames and filesize

2012-08-23 Thread Tigerstyle
Hi. I need help with an assignment and I hope you guys can guide me in the right direction. This is the code: -- """ Demostration of setUp and tearDown. The tests do not actually test anything - this is a demo. """ import unittest import tempfile import shutil import glob import

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 11 Sep, 04:12, t...@thsu.org wrote: > On Sep 10, 7:47 am, Peter Otten <__pete...@web.de> wrote: > > > > > > > > > > > Tigerstyle wrote: > > > I'm strugglin with some homework stuff and am hoping you can help me > > > out here. &

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 11 Sep, 08:18, Dennis Lee Bieber wrote: > On Sat, 10 Sep 2011 16:25:42 -0700, Dennis Lee Bieber > declaimed the following in > gmane.comp.python.general: > > > > > in the language documentation... It will give you a simple way to know > > if you are looking at the first word. Basically, you wa

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 17:56, Chris Angelico wrote: > On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware > > wrote: > > Ignoring the docttests my process would be to process each word & then > > manually capitalize he 1st word, .I would als0 use a comprehension as > > makes for cleaner code:- > > > def capitaliz

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:43, Mel wrote: > Tigerstyle wrote: > > Hi guys. > > > I'm strugglin with some homework stuff and am hoping you can help me > > out here. > > > This is the code: > > > small_words = ('into', 'the', 'a', &#

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:50, Thomas Jollans wrote: > On 10/09/11 13:20, Tigerstyle wrote: > > > Hi guys. > > > I'm strugglin with some homework stuff and am hoping you can help me > > out here. > > > All tests are failing even though I am getting the correct output

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 19:59, Terry Reedy wrote: > On 9/10/2011 7:20 AM, Tigerstyle wrote: > > > Hi guys. > > > I'm strugglin with some homework stuff and am hoping you can help me > > out here. > > We appreciate you saying so instead of hiding that this is homew

Doctest failing

2011-09-10 Thread Tigerstyle
Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title): """ Takes a string and returns a title-case string. All words EXCEPT for small words are mad