samedi 18 avril 2015

Confused by list behavior of python [duplicate]


This question already has an answer here:




Iam a novice in Python .Python list cannot be amended in a loop . The output for this is unchanged array str1. Iam trying to make this list zero.This is a little strange for me . Why cant I change the elements of the list ?



import re,string
str1=["This is a review","This is not a review"]
for each in str1:
each=" "
print str1


Any clue?


Aucun commentaire:

Enregistrer un commentaire