Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to make separate text in file and make it print in new line
    text
    copied!<p>I have a text such as:</p> <pre><code>count, 93mosts, your avglen, 4.419354838709677shorts, ['i', 'a']longs, ['stretched'] </code></pre> <p>how do I make it look like this?</p> <pre><code>shorts:in,me,of,us longs:calibrate,fantastic mosts:even,more,words count:anIntVal avglen:aFloatVal ab 5 and 8 ... yours 2 </code></pre> <p>here is what I do to put the dictionary in the file:</p> <pre><code>def write_report(r, filename): with open(filename, "w") as f: for k, v in r.items(): f.write('{}, {}'.format(k, v) ) f.close() return f </code></pre> <p>original dictionary:</p> <pre><code>{'shorts': ['i', 'a'], 'mosts': 'your', 'avglen': 4.419354838709677, 'count': 93, 'longs': ['stretched'], 'freqs': {'yet': 1, 'but': 2, 'of': 4, 'most': 1, 'that': 1, 'number': 1, 'less': 1, 'neer': 1, 'than': 1, 'deserts': 1, 'lies': 1, 'so': 1, 'song': 1, 'all': 1, 'write': 1, 'your': 6, 'shows': 1, 'come': 2, 'hides': 1, 'beauty': 1, 'half': 1, 'not': 1, 'earthly': 1, 'alive': 1, 'child': 1, 'touched': 1, 'papers': 1, 'graces': 1, 'poet': 1, 'knows': 1, 'some': 1, 'to': 2, 'touches': 1, 'old': 1, 'yellowed': 1, 'eyes': 1, 'say': 1, 'and': 5, 'time': 2, 'tongue': 1, 'life': 1, 'could': 1, 'fresh': 1, 'age': 2, 'filled': 1, 'were': 2, 'rhyme': 1, 'men': 1, 'will': 1, 'rage': 1, 'true': 1, 'believe': 1, 'metre': 1, 'termed': 1, 'you': 1, 'stretched': 1, 'high': 1, 'my': 3, 'is': 1, 'like': 1, 'an': 1, 'it': 3, 'heavenly': 1, 'though': 1, 'antique': 1, 'rights': 1, 'who': 1, 'the': 2, 'verse': 1, 'if': 2, 'as': 1, 'in': 4, 'should': 2, 'with': 2, 'i': 1, 'parts': 1, 'live': 1, 'a': 2, 'such': 1, 'truth': 1, 'heaven': 1, 'tomb': 1, 'be': 2, 'their': 1, 'which': 1, 'scorned': 1, 'would': 1, 'faces': 1, 'poets': 1, 'numbers': 1, 'yours': 1, 'twice': 1, 'this': 1}} </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload