Question

I have a list :

A = ['Yes']

I want to have

A = ['Yes',None]

How can I do this?

Was it helpful?

Solution

Just use append:

A.append(None)

>>> print A
['Yes', None]

OTHER TIPS

Simple:

A.append(None)

or

A += [None]

or

A.extend([None])

or

A[len(A):] = [None]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top