<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 23 October 2015 at 11:38, Peter Kjellerstedt <span dir="ltr">&lt;<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>&gt;</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(&quot;:&quot;)<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() + &quot;::::::&quot;<br>
+                        field = line.split(&quot;:&quot;)</div></blockquote></div><br>It&#39;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(&quot;:&quot;)</div><div class="gmail_extra">  field += [&#39;&#39;] * (7 - len(field))</div><div class="gmail_extra"><br></div><div class="gmail_extra">Ross</div></div>