<p>到目前为止这是我的代码</p>
<pre><code>print("L = ",[4,10,4,2,9,5,4])
Startlist = [4,10,4,2,9,5,4]
usrinput = int(input("Enter an element to search for in the list: "))
for i in [i for i,x in enumerate(Startlist) if x == usrinput]:
print(i)
</code></pre>
<p>不过,我正在尝试从打印的for循环中创建一个新的列表数字。这个是我输入4得到的样本吗</p>
<pre><code>L = [4, 10, 4, 2, 9, 5, 4]
Enter an element to search for in the list: 4
0
2
6
</code></pre>
<p>如何将0 2 6转换为[0,2,6]?你知道吗</p>
<p>谢谢你的回复</p>