Domanda

I have a list :

A = ['Yes']

I want to have

A = ['Yes',None]

How can I do this?

È stato utile?

Soluzione

Just use append:

A.append(None)

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

Altri suggerimenti

Simple:

A.append(None)

or

A += [None]

or

A.extend([None])

or

A[len(A):] = [None]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top