class images: def GET(self,name): ext = name.split(".")[-1] cType = {"png":"images/png","jpg":"image/jpg","gif":"image/gif"} web.header("Content-Type", cType[ext]) print open('images/%s'%name,"rb").read()