Path: csiph.com!usenet.pasdenom.info!news.etla.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!feeds.news.ox.ac.uk!news.ox.ac.uk!zen.net.uk!hamilton.zen.co.uk!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'say,': 0.05; 'indexing': 0.07; 'subject:file': 0.07; 'spaces': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'subject:.txt': 0.16; 'tabs': 0.16; 'wrote:': 0.18; 'recognize': 0.24; 'subject: .': 0.24; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'have,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'names.': 0.31; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'manufacturer': 0.36; 'received:209': 0.37; 'thank': 0.38; 'ends': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; "you're": 0.61; 'between': 0.67; 'car': 0.72; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=ta2nucM9xuCU/n4eAmlAtzRyjmtyvQhEMjqKba+95Bk=; b=LSQZiTvZnEo8XASu3LPrBnqrsDJWX7ot46jRqKVlXvHU/nXb4NmDTl6JIOnJtC1tRy mSqkEpEpbtAAGNxpmeGxtqXRxH8RzviKlCVVei9020eYOoF9geXiog/D4O2Uisl+ndpA 3N5x1O71aZA8cES/x9sIh1sKkgkUOQNiBX5382vYcuLqmUXk55m5Inls5Bwdjhh9bT5M 8DOHCKb+KfO/Wabx7moQG1YvBieZbwL9xp58xyLF2APKftUmjhVjy2y/m4/RUCjbLqx7 /OVRK8F0QXwUjxiaDT6MrJVSAIntbigIHDZPLelMEB0xdZqVOfQ2TpUJpE30k9Gnhu3t 3/1Q== MIME-Version: 1.0 X-Received: by 10.52.88.197 with SMTP id bi5mr6035068vdb.58.1364750564670; Sun, 31 Mar 2013 10:22:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Apr 2013 04:22:44 +1100 Subject: Re: Creating a dictionary from a .txt file From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 8 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364750566 news.xs4all.nl 6851 [2001:888:2000:d::a6]:48256 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42385 On Mon, Apr 1, 2013 at 4:19 AM, C.T. wrote: > Thank you, Chris! I could use slicing and indexing to build the dictionary but the problem is with the car manufacturer an the car model. Either or both could be multiple names. Then you're going to need some other form of magic to recognize where the manufacturer ends and the model starts. Do you have, say, tabs between the fields and spaces within? ChrisA