Peter Otten wrote: ...
Here's a different approach:
...
raster_string = ...width = raster_string.index("\n") height = raster_string.count("\n")
your approach has a funny side-effect: try to remove just one zero from the first line of the raster ;-)
bye -- http://mail.python.org/mailman/listinfo/python-list