Changeset 8799:1b58ed318463 in orange


Ignore:
Timestamp:
08/26/11 11:33:53 (3 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
106524050782667c23d7bef91ca9e6566ae0306e
Message:

Read unicode strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/network/readwrite.py

    r8783 r8799  
    9191    if G.number_of_nodes() > 0: 
    9292        features = list(set(itertools.chain.from_iterable(node.iterkeys() for node in G.node.itervalues()))) 
    93         data = [[node.get(f).replace('\t', ' ') if type(node.get(f, 1)) == str else str(node.get(f, '?')) for f in features] for node in G.node.itervalues()] 
     93        data = [[node.get(f).encode('utf-8').replace('\t', ' ') if type(node.get(f, 1)) == str or type(node.get(f, 1)) == unicode else str(node.get(f, '?')) for f in features] for node in G.node.itervalues()] 
    9494        fp = tempfile.NamedTemporaryFile('wt', suffix='.txt', delete=False) 
    9595        fp.write('\n'.join('\t'.join(line) for line in [features] + data)) 
Note: See TracChangeset for help on using the changeset viewer.