so i want to remove an item from a list and store it into the variable at the same time in python. I tried a sample code like this:
rvals = []
rvals.append(\
list.remove(x)
Remove the first item from the list whose value is x. It is an error if there is no such item.
So, as stated in the docs, you will not get the value returned.
This can help:
value = "row"
rvals = []
rvals.append(value)
print rvals.pop(rvals.index(value))
Or just use pop(), if you only want to remove and get the last inserted item:
value = "row"
rvals = []
rvals.append(value)
print rvals.pop()
Output:
row