I have a question about list concatenation in Python, I have this piece of code:
def lista():
word = sys.argv[1]
l = []
m = []
for file_name in sys.argv[2:]:
with open(file_name, "r") as f:
for line in f:
l + [len(re.findall(word, line))] #doesn't work
m.append(len(re.findall(word, line))) #works
print l
print m
return l
when I run this function I always get empty list l, but there are elements in m, why l+[elem] doesen't work for me?