Hello everyone,

I was wondering if someone could show me a better way to achieve what
I am trying to do.  Here is my test code:

    d=[]
    c="00"
    a="A,B,C,D"
    b=a.split(',')
    for item in b:
        d.append(item)
        d.append(c)
    print tuple(d)

Basically what I want to end up with is a tuple that looks like this:
("A","00","B","00","C","00")...

As you can see I want to insert 00 in-between each element in the
list.  I believe this could be done using a list comprehension?

I realize I achieved my goal, but I was wondering what other
alternates could be done to achieve the same results.

Thanks in advance for your assistance.

Mike.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to