python - print to print as comma separated values on the same line -


i unable print output on single line without printing new lines, following code shows syntax error:

print( "tiers found:"+eval("str.lower(tier.attrib['tier_id'])"), end=', ')                                                                         ^ syntaxerror: invalid syntax 

but works fine:

print( "tiers found:"+eval("str.lower(tier.attrib['tier_id'])")) 

the print statement in loop , require print output comma separated list. whats problem here?

why using eval on sane statement?

from __future__ import print_function print('tiers found: {0}'.format(tier.attrib['tier_id'].lower()), end=',') 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -