Yoriz' link should be very helpful to you, but if you want to really learn about how bitmaps work you can check out the technical spec
. If you just want it to work, you can download any source files that you would normally install and just put them in the place you're running Python to get things to work. It's quick and dirty, and but should solve your problem even though it's not something people normally do.
By the way, your code doesn't do anything other than create a file. You get the write() method from the object, but you don't call it or pass anything to it. I mean, there isn't even anything in your code that you would