Changeset 10550:0513feac4643 in orange for Orange/data/io.py


Ignore:
Timestamp:
03/15/12 17:03:19 (2 years ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed string escaping in load_csv/save_csv.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/data/io.py

    r10532 r10550  
    451451        elif index == -1: 
    452452            res.append(str[start:]) 
    453     return res 
     453    return [r.replace(escape + split_str, split_str) for r in res] 
    454454 
    455455def is_standard_var_def(cell): 
     
    673673    missing_map = dict.fromkeys(missing_flags, "?") 
    674674    missing_translate = lambda val: missing_map.get(val, val) 
    675         
     675     
    676676    # Create domain variables or corresponding place holders 
    677677    for i, (name, var_t) in enumerate(zip(header, types)): 
     
    818818        for v in all_vars: 
    819819            if isinstance(v, variable.Discrete): 
    820                 type_cells.append(",".join(v.values)) 
     820                escaped_values = [val.replace(" ", r"\ ") for val in v.values] 
     821                type_cells.append(" ".join(escaped_values)) 
    821822            elif isinstance(v, variable.Continuous): 
    822823                type_cells.append("continuous") 
Note: See TracChangeset for help on using the changeset viewer.