Understanding Python 3 lists printing None value for each element

前端 未结 2 1163
小蘑菇
小蘑菇 2020-11-30 14:58

As a very noob with in Python I\'m printing all elements of a list in version 3, and after a comprehensive research I couldn\'t find an explanation for this kind of behavior

2条回答
  •  情话喂你
    2020-11-30 15:56

    None is the return value of the print function.

    Don't use [print(f) for f in a_list] when you mean for f in a_list: print(f).

提交回复
热议问题