<p>我正试图将一个正数列表转换为一个负数列表,在python 3.3.3中具有相同的值</p>
<p>例如将<code>[1,2,3]</code>转换为<code>[-1,-2,-3]</code></p>
<p>我有这个密码:</p>
<pre><code>xamount=int(input("How much of x is there"))
integeramount=int(input("How much of the integer is there"))
a=1
lista=[]
while(a<=integeramount):
if(integeramount%a==0):
lista.extend([a])
a=a+1
listb=lista
print(listb)
[ -x for x in listb]
print(listb)
</code></pre>
<p>当我希望一个是正数,一个是负数时,这将打印两个相同的列表。</p>