Hi,

You should write your last two lines as ...

        x = DemoClass()
        x.WriteToFile()

Don't miss paranthesis again... :)

Maybe there are still some mistakes too. Does dump method writes list's 
elements?

Sönmez

tonyr1988 wrote:
> I'm a complete python n00b writing my first program (or attempting to,
> anyway). I'm trying to make the transition from Java, so if you could
> help me, it would be greatly appreciated. Here's the code I'm stuck on
> (It's very basic):
> 
> class DemoClass:
>       def __init__(self):
>               self.title = ["Hello", "Goodbye"]
> 
>       def WriteToFile(self, path = "test.txt"):
>               fw = file(path, "w")
>               pickle.dump(self.title, fw)
>               fw.close()
> 
> if __name__=='__main__':
>       x = DemoClass
>       x.WriteToFile
> 
> It doesn't do any file I/O at all (that I see). I hope my syntax is
> alright. If I just call WriteToFile, shouldn't it perform with the
> default path? It gives me no errors and pretends to execute just fine.
> 

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to