Latest recipes tagged "read"http://code.activestate.com/recipes/tags/read/new/2011-06-12T16:34:12-07:00ActiveState Code RecipesFor AMIGA-Heads Only. PAR: As A VOLUME In READ Mode Only. (Python) 2011-06-12T16:34:12-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577750-for-amiga-heads-only-par-as-a-volume-in-read-mode-/ <p style="color: grey"> Python recipe 577750 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/parallel/">parallel</a>, <a href="/recipes/tags/parallel_port/">parallel_port</a>, <a href="/recipes/tags/port/">port</a>, <a href="/recipes/tags/read/">read</a>). </p> <p>PAR: as a VOLUME in READ mode using Python 1.4 onwards on Classic AMIGAs...</p> <p>Many years ago Irmen de Jong ported Python to the Classic AMIGA range of computers, (many thanks Irmen for your time in doing so). The versions were at least 1.4.x to 2.0.1 and now someone else has included version 2.4.6.</p> <p>This gives we lowly users of the AMIGA at least a chance to see and use Python in some guise or another. This code shows how to access the AMIGA parallel port for 8 bit READ only. This is so that ADCs could be attached to the port, read by Python code EASILY and utilised as a Data Logger/Transient Recorder, as just one example.</p> <p>There needs to be a single HW WIRE link only from the 23 way video port to the 25 way parallel port for this to work. See the archive......</p> <p><a href="http://aminet.net/package/docs/hard/PAR_READ" rel="nofollow">http://aminet.net/package/docs/hard/PAR_READ</a></p> <p>......on how to set about this extremely simple task.</p> <p>NO knowledge of the parallel port programming is needed at all to grab 8 bit data from it using Python and other languages; (ARexx is used in the archive above).</p> <p>There is a flaw, NOTE:- NOT A BUG!, in the Python code but for this DEMO it is ignored. ;o)</p> <p>I'll let all you big guns work out what it is; you will need a good working knowledge of the Classic AMIGA.</p> <p>Enjoy finding simple solutions to often very difficult problems. ;o)</p> <p>This code is Public Domain and you may do with it as you please.</p> <p>Bazza...</p> File read/write routines (Python) 2010-04-18T17:18:50-07:00Denis Barmenkovhttp://code.activestate.com/recipes/users/57155/http://code.activestate.com/recipes/577199-file-readwrite-routines/ <p style="color: grey"> Python recipe 577199 by <a href="/recipes/users/57155/">Denis Barmenkov</a> (<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/read/">read</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/write/">write</a>). Revision 2. </p> <p>For small dirty hacks in Perl has a module File::Slurp. I wrote two simple functions when I moving from Perl to Python - one for reading files and second for writing files. Valuable data is list of lines or blob (additionally specified argument binmode=1).</p>