Help Required
Bengt Richter
bokr at oz.net
Fri Mar 15 20:45:42 EST 2002
On 15 Mar 2002 17:24:33 -0800, surajsub at netscape.net (Surajsub) wrote:
>Hi,
>I am a newbie to Python and am pretty fascinated by it power and
>speed.I am however puzzled in trying to write this script.
>The script builds a list of userids to be fed to ldap and it is
>supposed to be
>
>uid1,uid2,uid3....and so on.( Notice there is no space)
>
>However when i am trying to create the uid list it gives
>
>uid1, uid2, uid3,...and so on.
>how do i get rid of this leading space if u would call it..
>string.lstrip does not work either.
>
>what am i doing wrong?
It would be easier to say if you showed us what you are doing ;-)
Where are your uid's coming from in your program?
Assuming some function getuid() produces 'uid1' or 'uid2' etc
each time, and '' or None when there's no more,
#----< UNTESTED! >----------
uids = []
while 1:
uid = getuid()
if not uid: break
uids.append(uid)
combined = ','.join(uids)
#---------------------------
should give you 'uid1,uid2,uid2' etc. bound to combined.
Regards,
Bengt Richter
More information about the Python-list
mailing list