0
python questions
I have two lists: a = [1,2,3,4,5] b = [] i want b to be: b = [[1],[2],[3],[4],[5]]
2 Respostas
+ 1
You can use for loop to change them :
for i in a :
a[i] = list(a[i])
This is better because you may have an unknown list.
- 1
a = [1, 2, 3, 4, 5]
b = []
for i in a:
b.extend([[i]])
print(b)
Hope, you get some help.Good luck.