I am trying to read a list,values can be single or it can have multiple entries seperated by a comma,my goal is to append href link for the first value in the list ,col[0] namely,am running into following compilation error
INPUT:-
cols=['409452, 12345', '', '', 'This a test python script']
EXPECTED OUTPUT:-
<tr>
<td><a href=http://data/409452>409452,<a href=http://data/12345>12345</a></td>
<td></td>
<td></td>
<td>This a test python script</td>
Python code:-
cols=cols=['409452, 12345', '', '', 'This a test python script']
TEMPLATE = [' <tr>']
for col in cols:
value = col.split(",")
TEMPLATE.append(
' <td><a href=http://data/{}> {}</a></td>'.format(value)
TEMPLATE.append(' </tr>')
TEMPLATE = '\n'.join(TEMPLATE)
print TEMPLATE
Output I am getting:-
TEMPLATE.append(' </tr>')
^
SyntaxError: invalid syntax