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 extension (.txt, .doc, etc

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: f =

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: 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 of the current working directory and print out

Re: Unittest - testing for filenames and filesize

2012-08-26 Thread Tigerstyle
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(self): f = open(test.dat, wb) filesize = b0*100

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) I'm still getting AssertionError

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

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 os

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 19:59, Terry Reedy tjre...@udel.edu 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 homework. small_words

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:50, Thomas Jollans t...@jollybox.de 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 on the first two tests. And the last

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:43, Mel mwil...@the-wire.com 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', 'of', 'at', 'in', 'for', 'on') def book_title(title):     Takes

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 17:56, Chris Angelico ros...@gmail.com wrote: On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware alister.w...@ntlworld.com 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

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 11 Sep, 08:18, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sat, 10 Sep 2011 16:25:42 -0700, Dennis Lee Bieber wlfr...@ix.netcom.com 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

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. This is the code: small_words

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 made