You were close to it. But you need to append new elements in the inner loop to an empty list, which will be append as element of the outer list. Otherwise you will get (as you can see from your code) a flat list of 100 elements.
newlist = []
for x in range(10):
innerlist = []
for y in range(10):
innerlist.append(y)
newlist.append(innerlist)
print(newlist)
See the comment below by B?otosm?tek for a more concise version of it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…