Help Required

Cromwell, Jeremy jcromwell at ciena.com
Sat Mar 16 12:29:53 EST 2002


Like the others, I'd like to see the code, but I'll take a shot at your
problem.  I'm guessing that your problem is printing.  Here's an example I
created using the interpreter that might help.

>>> uid1 = 'user1'
>>> uid2 = 'user2'
>>> uid3 = 'user3'
>>> print uid1,uid2,uid3
user1 user2 user3
>>> print uid1, uid2, uid3
user1 user2 user3
>>> print uid1   ,         uid2    ,       uid3
user1 user2 user3
>>> print uid1+uid2+uid3
user1user2user3
>>> print "%s,%s,%s" % (uid1,uid2,uid3)
user1,user2,user3
>>> print "%s%s%s" % (uid1,uid2,uid3)
user1user2user3
>>> print "%s, %s, %s" % (uid1,uid2,uid3)
user1, user2, user3
>>> print ",".join((uid1,uid2,uid3))
user1,user2,user3
>>> print ", ".join((uid1,uid2,uid3))
user1, user2, user3
>>> print "".join((uid1,uid2,uid3))
user1user2user3
>>> ids = uid1,uid2,uid3
>>> print ids
('user1', 'user2', 'user3')
>>> type(ids)
<type 'tuple'>
>>> ids = uid1+uid2+uid3
>>> print ids
user1user2user3
>>> type(ids)
<type 'str'>
>>> ids = "%s, %s, %s" % (uid1,uid2,uid3)
>>> print ids
user1, user2, user3
>>> type(ids)
<type 'str'>
>>> ids = ",".join((uid1,uid2,uid3))
>>> print ids
user1,user2,user3
>>> type(ids)
<type 'str'>

Hope this helps.
-Jeremy Cromwell

-----Original Message-----
From: surajsub at netscape.net [mailto:surajsub at netscape.net]
Sent: Friday, March 15, 2002 5:25 PM
To: python-list at python.org
Subject: Help Required


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?
TIA
Suraj
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list