I have the following list:
result_lines = ['hello', 'bye']
I trying to form a one-liner to print the elements of the list as follows:
print(line for line in result_lines)
Expected Result:
hello
bye
Output (that I am getting):
<generator object execute_commands.. at 0x7f9e37a9b900>
EDIT:
Also, how is the above approach different from :
for line in result_lines:
print(line)
I am not able to figure out why this is happening. Any help is appreciated.