homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Alexqw, terry.reedy
Date 2013年04月12日.19:39:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365795556.05.0.830222479601.issue17676@psf.upfronthosting.co.za>
In-reply-to
Content
The docs for pwd and spwd modules specify that some items are strings and others are ints. Null strings should be '' and 'null' ints must be negative since 0 can be a valid item. It happens that all but 2 pwd items are strings and all but 2 spwd items are ints. The 2 pwd int items are uid and gid, which I believe are never missing, so you never encounter -1 for them. Similarly, the 2 spwd str items are nam and pwd, which I believe are not missing either, so you never encounter '' for them. Otherwise, your val != -1 test would not work.
I believe the following expression will work for spwd (and even pwd) (I cannot test on Windows ;-).
':'.join((str(val) if val != -1 else '') for val in rec)
History
Date User Action Args
2013年04月12日 19:39:16terry.reedysetrecipients: + terry.reedy, Alexqw
2013年04月12日 19:39:16terry.reedysetmessageid: <1365795556.05.0.830222479601.issue17676@psf.upfronthosting.co.za>
2013年04月12日 19:39:16terry.reedylinkissue17676 messages
2013年04月12日 19:39:15terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /