 <p>If the gaps are being created by whitespace you can use the built in String method <a href="https://docs.python.org/2/library/string.html#string.strip" rel="nofollow">strip()</a></p> <p>If its is a database artifact you may have to give us more information.</p>