fork download
  1. def getInt(n):
  2. res=[]
  3. c=0
  4. while(True):
  5. tmp=input()
  6. tmp=tmp.strip()
  7. acc=""
  8. l=len(tmp)
  9. for i in range(l):
  10. if (tmp[i]==' ') | (tmp[i]==','):
  11. if len(acc)>0:
  12. res+=[int(acc)]
  13. c+=1
  14. acc=""
  15. else:
  16. if (tmp[i]>='0') & (tmp[i]<='9'):
  17. acc+=tmp[i]
  18. if len(acc)>0:
  19. res+=[int(acc)]
  20. c+=1
  21. acc=""
  22. if (c>n):
  23. break
  24. return res[:n]
  25.  
  26. x=getInt(10)
  27. print(str(x))
  28.  
  29.  
  30.  
Success #stdin #stdout 0.01s 27712KB
stdin
1
2,
3,4,5,6,,
7,8,9 10 11 12
stdout
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]