Functions, by default, return None
if they come to the end of themselves without returning. So, since there are no return
statements in func
, it will return None
when called.
Furthermore, by using print func(my_list)
, you are telling Python to print what is returned by func
, which is None
.
To fix your problem, just drop the print
and do:
func(my_list)
Also, if my_list
isn't very long, then you don't really need a function at all to do what you are doing. Just use the join
method of a string like so:
>>> my_list = ['a','b','c']
>>> print "\n".join(my_list)
a
b
c
>>>