daedae11 wrote:
2. I think it's a little tedious, but I don't know how to improve it.
Welcome to programming!
In the school books and example code, you see a nice, clean, fifteen line
function and think that programming is easy.
Then you try to write the program, and you start of with 15
Devin Jeanpierre wrote:
Inheriting from SyntaxError doesn't work! When I create a new exception, I
generally subclass from the built-in exception it most resembles, in case
there was some reason to also catch it via an ancestor. But I'm not sure if
that is really all that useful an idea in prac
Chris Fuller wrote:
class Foo(SyntaxError):
... def __init__(self, a,b,c):
... self.args = (a,b,c)
...
raise Foo(1,2,3)
Traceback (most recent call last):
File "", line 1, in
__main__.Foo: None
Inheriting from SyntaxError doesn't work! When I create a new exception, I
generally sub
> Inheriting from SyntaxError doesn't work! When I create a new exception, I
> generally subclass from the built-in exception it most resembles, in case
> there was some reason to also catch it via an ancestor. But I'm not sure if
> that is really all that useful an idea in practice. How do you
I was asked to write a program to move files between ZIP(.zip) and
TAR/GZIP(.tgz/.tar.gz) or TAR/BZIP2(.tbz/.tar.bz2) archive.
my code is:
import zipfile;
import tarfile;
import os;
from os import path ;
def showAllFiles(fileObj):
if fileObj.filename.endswith("zip"):
if isinstance
I had an interesting experience today.
Python 2.7.1 (r271:86832, Nov 28 2010, 19:31:37)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
... def __init__(self, a,b,c):
... self.args = (a,b,c)
...
>>> raise Foo(1,2,3)
Traceb
On 01/06/2012 03:05 PM, Garland W. Binns wrote:
Hello, I have been experimenting with trying to rewrite the following
script so that a computer tries to guess a number I'm thinking of:
https://gist.github.com/1572067
I was thinking that basically I need to create a while loop, and somehow
redefi
Hello, I have been experimenting with trying to rewrite the following
script so that a computer tries to guess a number I'm thinking of:
https://gist.github.com/1572067
I was thinking that basically I need to create a while loop, and somehow
redefine the randrange depending on whether or not I pro
On 01/06/2012 04:16 AM, Alan Gauld wrote:
That's a non trivial application. It sounds a lot like Google maps?
If by map you meant real world maps, this task becomes pretty much
trivial. It is fairly easy to embed Google Map in your own web app, and
their API provides a lot for almost anything