Fix Python – How to unnest (explode) a column in a pandas DataFrame, into multiple rows

I have the following DataFrame where one of the columns is an object (list type cell):
df=pd.DataFrame({‘A’:[1,2],’B’:[[1,2],[1,2]]})
df
Out[458]:
A B
0 1 [1, 2]
1 2 [1, 2]

My expected output is:
A B
0 1 1
1 1 2
3 2 1
4 2 2

What should I do to achieve this?

Related question
pandas: When cell contents are lists, creat….