How to make line-by-line output to python?

Hi!
There is a task:
Let's consider a given a list containing strings.
Print line by line, all lines in the size from 5 to 10 characters.

The code I have is this:
text = "'Hockey','Basketball','Auto','Lezy','Soccer','Sverxderzhava'"
print([e for e in eval('('+text+')') if len(e)>=5 and len(e)<10])


The result:
['Hockey', 'Soccer']

Can't figure out where to correctly add '\n' that would output each word was progressive.
March 23rd 20 at 18:52
2 answers
March 23rd 20 at 18:54
Solution
So what?:
import json
im in for json.loads(f'[{text}]'.replace('\", '"')):
 if len(im)>5 and len(im)<10:
 print(im)


either way:

import ast
for im in filter(lambda x: len(x)>5 and len(x)<10, ast.literal_eval(text)):
 print(im)


Conclusion:
Hockey
Soccer
eval(text)

I can't believe now. What else do newbies learn? Can exec from ozerskogo input to perform? - Bertram_Hean commented on March 23rd 20 at 18:57
@Bertram_Hean, I just changed polzovateley code.
We can be there religion is this - to use eval.. - karelle.Hacke commented on March 23rd 20 at 19:00
@Bertram_Hean, Assimilating Hindu experience, so to speak. - Nola.Stark commented on March 23rd 20 at 19:03
@Bertram_Hean, corrected - karelle.Hacke commented on March 23rd 20 at 19:06
@karelle.Hacke, then it would be advised to replace on the ast.literal_eval - Bertram_Hean commented on March 23rd 20 at 19:09
@Bertram_Hean, yeah - karelle.Hacke commented on March 23rd 20 at 19:12
March 23rd 20 at 18:56
To heap offer an alternative option without cycles.
text = "'Hockey','Basketball','Auto','Lezy','Soccer','Sverxderzhava'"
array = text.replace("'", "").split(",")
array = list(filter(lambda x: (len(x)>=5) and (len(x)<=10) array))
print("\n".join(array))

Find more questions by tags Python