Skip to content

Instantly share code, notes, and snippets.

@hronecviktor
Created October 1, 2013 10:37
Show Gist options
  • Save hronecviktor/6776653 to your computer and use it in GitHub Desktop.
Save hronecviktor/6776653 to your computer and use it in GitHub Desktop.
csv
import sys
def main(args):
lines=[]
while True :
try :
line = input("Enter comma separated values: ")
if not line :
break
lines.append(line)
print(line)
print(lines)
except ValueError :
print("Valerror")
break
except EOFError :
print("EOFerr")
break
printTable(lines)
def printTable(lines):
print("<table>")
formLines=[]
for line in lines:
line=line.replace("\"","")
formLines.append(line.split(","))
#print(line)
#print(formLines)
for line in formLines:
print("<tr>")
for cell in line:
print("<td>"+cell+"</td>")
print("</tr>")
print("</table>")
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment