range list and remove

Solved by making a list form the range

alphabet=list(range(0,26))

&&&&&&&&&&&

trying to port an old script to latest pytnon 3.3

got this

alphabet=range(0,26)
now this does not give a list but a range
it can be acces with list but i think in the old script the alphabetvar has to be a list

cause later on there is a random selection and then i trys to remove a value but i does not work



  refabet=copy(alphabet)
  self.reflector=copy(alphabet)
 
 
  print()
  print ('refabet  =',refabet)
  print ('len(refabet)  =',len(refabet))
  print ()
 
  while len(refabet)>0:
 
   a=choice(list(refabet))
   print()
   print ('choice(refabet) a  =',a)
   print ()
   print ()
   print ('refabet =',refabet)
   print ()
   print ('list refabet =',list(refabet))
   print ()
 
   refabet.remove(a)




the remove command here crashes !

here is the print in console

refabet = range(0, 26)
len(refabet) = 26

choice(refabet) a = 15

refabet = range(0, 26)
list refabet = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
, 19, 20, 21, 22, 23, 24, 25]

Traceback (most recent call last):

AttributeError: ‘range’ object has no attribute ‘remove’

thanks

Refabet is an iterator. Make it a list

Sent from my Nexus 7 using Tapatalk 4 Beta