Newbie array question
Neale
nhirsh2 at ieee.org
Mon Jun 14 10:22:10 EDT 2004
More information about the Python-list mailing list
Mon Jun 14 10:22:10 EDT 2004
- Previous message (by thread): Newbie array question
- Next message (by thread): does python supported in WinCE/pocket pc?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
danb_83 at yahoo.com (Dan Bishop) wrote in message news:<ad052e5c.0406121517.4a3bd684 at posting.google.com>... > nhirsh2 at ieee.org (Neale) wrote in message news:<2d7af4f8.0406112032.4cb4438a at posting.google.com>... > > My first task with Python is to scan multiple small text files and > > "batch together" those records with a "5" or "6" in column 2, and then > > save as a new file. The records are 256 characters. I know it sounds > > like a homework problem, but it's not. > > Assuming that all your records are strings in an array called > "records", you can discard the ones without a '5' or '6' in column 2 > (column 1 in 0-based indexing) with: > > records = [r for r in records if r[1] in ('5', '6')] Thank you all for such high quality help. And fast, too!
- Previous message (by thread): Newbie array question
- Next message (by thread): does python supported in WinCE/pocket pc?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list