deleteing item from a copy of a list

timmy timothy at open-networks.net
Tue Nov 14 03:58:28 EST 2006


i make a copy of a list, and delete an item from it and it deletes it 
from the orginal as well, what the hell is going on?!?!?!

#create the staff copy of the roster
	Roster2 = []
	for ShiftLine in Roster:
		#delete phone number from staff copy
		Roster2.append(ShiftLine)
		del Roster2[len(Roster2)-1][1]

Roster2 should have nothing to do with Roster, right??? doing a print of 
both lists confirms that the phone number has been removed from both



More information about the Python-list mailing list