User Tools

Site Tools


python:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
python:index [2014/07/19 22:02] tkbletscpython:index [2014/07/19 22:04] tkbletsc
Line 121: Line 121:
  
 <code=python> <code=python>
-def parse_table(table_tsv, xform=None):+def recognize_type(v): 
 +    try: return float(v) 
 +    except ValueError: pass 
 +     
 +    try: return int(v) 
 +    except ValueError: pass 
 +     
 +    return v 
 +     
 +def parse_table(table_tsv, xform=recognize_type):
     table_rows = table_tsv.strip().split("\n")     table_rows = table_tsv.strip().split("\n")
  
Line 163: Line 172:
  
 </code> </code>
- 
  
python/index.txt · Last modified: 2014/07/20 17:48 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki