<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 23 October 2015 at 11:38, Peter Kjellerstedt <span dir="ltr"><<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2jn" class="" style="overflow:hidden">- field = line.rstrip().split(":")<br>
+ # Make sure there always are at least seven elements in<br>
+ # the field list. This allows for leaving out trailing<br>
+ # colons in the passwd file.<br>
+ line = line.rstrip() + "::::::"<br>
+ field = line.split(":")</div></blockquote></div><br>It's a stylist thing but I prefer padding the field list instead of manipulating the input string. Something like</div><div class="gmail_extra"><br></div><div class="gmail_extra"> field = line.strip().split(":")</div><div class="gmail_extra"> field += [''] * (7 - len(field))</div><div class="gmail_extra"><br></div><div class="gmail_extra">Ross</div></div>