Optional:  instead of split, use str.splitlines() method.  It's a little bit cleaner way, but what you have is fine too.