Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32090
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'deprecated': 0.07; 'python': 0.09; 'if,': 0.09; 'iterate': 0.09; 'received:mail-vc0-f174.google.com': 0.09; 'subject:into': 0.09; 'suggestions.': 0.09; 'cc:addr:python-list': 0.10; "(it's": 0.16; '2.7.3': 0.16; '24,': 0.16; 'command,': 0.16; 'deprecated.': 0.16; 'guessing': 0.16; 'iteration': 0.16; 'oct': 0.16; 'subject:array': 0.16; 'sugar': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'file.': 0.20; 'bit': 0.21; 'converted': 0.22; 'minor': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'task': 0.23; 'cc:no real name:2**0': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(e.g.': 0.27; '2.6': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'chris': 0.28; 'received:209.85.220.174': 0.29; 'yields': 0.29; "i'm": 0.29; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'comments': 0.33; 'loading': 0.33; 'everyone': 0.33; 'tutorial': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'method': 0.36; 'should': 0.36; 'october': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'solve': 0.62; 'worth': 0.63; 'great': 0.64; 'obtained': 0.71; 'manual,': 0.84; 'p.s.:': 0.84; 'sender:addr:chris': 0.84; 'hand.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EBt7L0PuKA3iaQGp7lkZq+lC2uxIzI8jU3YVkVRu2mU=; b=PDvQ4TIEygCErUWrm2b5JRS/hzDbKBds4NWZV6OcJI0BPTHksxNy1ALkiPqN44j4Zy okIIUS3w3Mhxs8JO7u1v0GE3H/eSaUzH/fw+I/j4SqgGFycKxDgm4WdCS6QkuNT9GCmL Q8Zz3/dt2oimNdZUB6v9v1eQcFNTVTCavf+mg= |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=EBt7L0PuKA3iaQGp7lkZq+lC2uxIzI8jU3YVkVRu2mU=; b=BUiP4CgRM11Sbbwh+jtpDuXWGMQ82IAHX0dbJ53ToVpSblB4Y8aIpqvXD0lNlTGDfi Ii1C09ym+Scp1nDcSpN1q2WwlzXavj3KQ1ig56zV25IMNOUbYLrGyf0FD9ZfCZFRdOM5 JZ8hVWP2BfBkn31+DiybD4cZQANkPtiFYxKe6If3UYeTCug9zQC/0Rtx6dx6umUHNfQ8 Vui493zffyCNAXhSO2tXRvrB+dLuHTF4QM84HE+NRoTJ0xwi3xC6uYWyy8EKkyEMqHGx DKHh8bNal16DS3vn0Y0+ebkfMh0K3o+i6e4kjR/FqUzbz+HmuGvo9ROZJ5WS9JHV5hLT KxZA== |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <d66a4294-0fc5-4435-8940-6f250467341f@googlegroups.com> |
| References | <07073002-d79f-46f6-83fc-8d20c51b39c3@googlegroups.com> <mailman.2727.1351058849.27098.python-list@python.org> <d66a4294-0fc5-4435-8940-6f250467341f@googlegroups.com> |
| Date | Wed, 24 Oct 2012 21:52:07 -0700 |
| X-Google-Sender-Auth | L_SC9XIxl8sbCcn8MOdkgmZuz60 |
| Subject | Re: turn list of letters into an array of integers |
| From | Chris Rebert <clp2@rebertia.com> |
| To | seektime <michael.j.krause@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Gm-Message-State | ALoCoQmA5LW8C/BqjmfeifkfwwOWvW0RVrjBuE4RJkixykpyOTBMD2I6anAVK4FrxWmdu6Zb7ImI |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2812.1351140730.27098.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351140730 news.xs4all.nl 6850 [2001:888:2000:d::a6]:48446 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32090 |
Show key headers only | View raw
On Wed, Oct 24, 2012 at 9:27 PM, seektime <michael.j.krause@gmail.com> wrote: > On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote: <snip> >> P.S.: I'm guessing you obtained `L` from file.readlines() or similar; >> it is worth noting for future reference that the readlines() method is >> considered somewhat deprecated. > > Thanks to everyone lots of great comments are actionable suggestions. > > My intension is to used the numpy/scipy packages to solve the task at hand. I agree that there's no point in loading a file into a format which only needs to be converted right after loading. But I'm new to Python the f.readline(s) command, according to the 2.7.3 tutorial and manual, is pretty much all there is for file i/o. If, as you indicated, f.readlines() is deprecated then what should I use instead? I'm using ver. 2.6 on Linux (it's a bit dated, I know). Just iterate over the file directly using a for-loop (e.g. `for line in some_file:`). Each iteration yields one line of the file. I used a very minor variation of this approach in my code (a list comprehension is just syntax sugar for a for-loop). Cheers, Chris
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
turn list of letters into an array of integers seektime <michael.j.krause@gmail.com> - 2012-10-23 22:23 -0700
Re: turn list of letters into an array of integers Demian Brecht <demianbrecht@gmail.com> - 2012-10-23 22:45 -0700
Re: turn list of letters into an array of integers David Hutto <dwightdhutto@gmail.com> - 2012-10-24 01:50 -0400
Re: turn list of letters into an array of integers Demian Brecht <demianbrecht@gmail.com> - 2012-10-23 22:51 -0700
Re: turn list of letters into an array of integers Demian Brecht <demianbrecht@gmail.com> - 2012-10-23 22:54 -0700
Re: turn list of letters into an array of integers Chris Rebert <clp2@rebertia.com> - 2012-10-23 23:07 -0700
Re: turn list of letters into an array of integers 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-24 05:03 -0700
Re: turn list of letters into an array of integers Robert Kern <robert.kern@gmail.com> - 2012-10-24 13:22 +0100
Re: turn list of letters into an array of integers 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-24 05:03 -0700
Re: turn list of letters into an array of integers seektime <michael.j.krause@gmail.com> - 2012-10-24 21:27 -0700
Re: turn list of letters into an array of integers Chris Rebert <clp2@rebertia.com> - 2012-10-24 21:52 -0700
Re: turn list of letters into an array of integers seektime <michael.j.krause@gmail.com> - 2012-10-24 21:27 -0700
Re: turn list of letters into an array of integers Peter Otten <__peter__@web.de> - 2012-10-24 09:47 +0200
Re: turn list of letters into an array of integers Peter Otten <__peter__@web.de> - 2012-10-24 11:04 +0200
Re: turn list of letters into an array of integers Terry Reedy <tjreedy@udel.edu> - 2012-10-24 11:56 -0400
Re: turn list of letters into an array of integers MRAB <python@mrabarnett.plus.com> - 2012-10-24 18:05 +0100
Re: turn list of letters into an array of integers wxjmfauth@gmail.com - 2012-10-24 10:27 -0700
Re: turn list of letters into an array of integers Demian Brecht <demianbrecht@gmail.com> - 2012-10-24 10:36 -0700
Re: turn list of letters into an array of integers Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-24 15:57 -0400
[OT] Re: turn list of letters into an array of integers Peter Otten <__peter__@web.de> - 2012-10-25 07:47 +0200
Re: [OT] Re: turn list of letters into an array of integers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-25 07:49 +0000
Re: [OT] Re: turn list of letters into an array of integers Peter Otten <__peter__@web.de> - 2012-10-25 10:25 +0200
Re: [OT] Re: turn list of letters into an array of integers Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-25 09:55 +0100
RE: turn list of letters into an array of integers "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-25 21:27 +0000
csiph-web