Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42387

Re: Creating a dictionary from a .txt file

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.070
X-Spam-Evidence '*H*': 0.86; '*S*': 0.00; 'output': 0.05; 'indexing': 0.07; 'subject:file': 0.07; 'invisible': 0.16; 'lie': 0.16; 'received:74.208.4.195': 0.16; 'subject:.txt': 0.16; 'tabs': 0.16; 'tuple,': 0.16; 'two.': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'header:User-Agent:1': 0.23; '31,': 0.24; 'subject: .': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'character': 0.29; 'characters': 0.30; 'supplier': 0.31; 'file': 0.32; 'running': 0.33; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'problem.': 0.35; 'but': 0.35; 'there': 0.35; 'manufacturer': 0.36; 'two': 0.37; 'thank': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'manually': 0.60; 'march': 0.61; "you're": 0.61; 'times': 0.62; 'between': 0.67; 'iron': 0.68; 'received:74.208': 0.68; 'press': 0.70; 'car': 0.72; '"it': 0.84; 'fields,': 0.84; 'ordered.': 0.84; '2013': 0.98
Date Sun, 31 Mar 2013 13:31:36 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4
MIME-Version 1.0
To python-list@python.org
Subject Re: Creating a dictionary from a .txt file
References <d15c39bc-5d2a-42c9-a76b-23768b61c391@googlegroups.com> <mailman.4019.1364746832.2939.python-list@python.org> <d1a5fee7-2ce6-4446-8193-587e4c12a0a0@googlegroups.com>
In-Reply-To <d1a5fee7-2ce6-4446-8193-587e4c12a0a0@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:ry8mAQOKka9e2g+21de2HXbUWddhZCyfUv5pDdWeacE mFko0cYMY/rxCZJtoRF9NHKI5TgnJDGqHN7EeHaEocG3jmUr+6 Aiw5/eKTCJXl3clXZNPxSm9uVh22rA/qvJJ3/jF1tZ2uhh3NKh CK5Bq1OXOL49cg97DZGzSoF++vXvYkCcdvlI4MUkYhAmx7phok PAjpZvrCdmeDQpXTyX/VH58NLm9Q+fdtT2pLOaKZIvAvP3R7U+ 8VvjjQF4niJgV8Dy4rrjbQ0S1xVIk2cdR8dcFk/8c8SYwz5ZqN O4bDaGR358TcPQMIJJtepbBjItiHj2hEszEZHKtXsK+k09r7k7 ChupEIhCCaSQnnH1BXkw=
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.4023.1364751102.2939.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364751102 news.xs4all.nl 6940 [2001:888:2000:d::a6]:54295
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42387

Show key headers only | View raw


On 03/31/2013 12:52 PM, C.T. wrote:
> On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote:
>>  <SNIP>
>>
>
> Thank you, Mark! My problem is the data isn't consistently ordered. I can use slicing and indexing to put the year into a tuple, but because a car manufacturer could have two names (ie, Aston Martin) or a car model could have two names(ie, Iron Duke), its harder to use slicing and indexing for those two.  I've added the following, but the output is still not what I need it to be.
>
>

So the correct answer is "it cannot be done," and an explanation.

Many times I've been given impossible conditions for a problem.  And 
invariably the correct solution is to press bac on the supplier of the 
constraints.

Unless there are some invisible characters in that file, lie tabs in 
between the fields, it loocs liec you're out of luc.  Or you could 
manually edit the file before running the program.

[The character after 'j' is broccen on this cceyboard.]
-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 08:52 -0700
  Re: Creating a dictionary from a .txt file Chris Angelico <rosuav@gmail.com> - 2013-04-01 03:06 +1100
    Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 10:19 -0700
      Re: Creating a dictionary from a .txt file Chris Angelico <rosuav@gmail.com> - 2013-04-01 04:22 +1100
    Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 10:19 -0700
  Re: Creating a dictionary from a .txt file Mark Janssen <dreamingforward@gmail.com> - 2013-03-31 09:20 -0700
    Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 09:52 -0700
      Re: Creating a dictionary from a .txt file Dave Angel <davea@davea.name> - 2013-03-31 13:31 -0400
        Re: Creating a dictionary from a .txt file Roy Smith <roy@panix.com> - 2013-03-31 14:41 -0400
          Re: Creating a dictionary from a .txt file Dave Angel <davea@davea.name> - 2013-03-31 17:37 -0400
          Re: Creating a dictionary from a .txt file Neil Cerutti <neilc@norwich.edu> - 2013-04-01 11:41 +0000
            Re: Creating a dictionary from a .txt file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-01 23:53 +0000
              Re: Creating a dictionary from a .txt file Walter Hurry <walterhurry@lavabit.com> - 2013-04-02 00:28 +0000
              Re: Creating a dictionary from a .txt file Neil Cerutti <neilc@norwich.edu> - 2013-04-03 12:55 +0000
    Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 09:52 -0700
  Re: Creating a dictionary from a .txt file Roy Smith <roy@panix.com> - 2013-03-31 12:38 -0400
    Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-03-31 10:28 -0700
  Re: Creating a dictionary from a .txt file Terry Jan Reedy <tjreedy@udel.edu> - 2013-03-31 15:04 -0400
  Re: Creating a dictionary from a .txt file "C.T." <swilks06@gmail.com> - 2013-04-01 16:53 -0700
    Re: Creating a dictionary from a .txt file Dave Angel <davea@davea.name> - 2013-04-01 20:12 -0400

csiph-web