The Artima Developer Community
Sponsored Link

Python Answers Forum
search patterns and parse data into dict

1 reply on 1 page. Most recent reply: Nov 5, 2007 10:11 AM by justin quick

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
adam adam

Posts: 1
Nickname: axn
Registered: Oct, 2007

search patterns and parse data into dict Posted: Oct 26, 2007 1:16 PM
Reply to this message Reply
Advertisement
i search for certain patterns in a file and then create a dict based on the pattern
re.search ('Name',line):
the file i am searching from has the same key each time i search but different value. (the file gets written into at intervals hence the different values). lets say this is the line. 'Name <john> Age <23>'. i want to be able to parse that value each time when i ran it? how can i do that


justin quick

Posts: 3
Nickname: justquick
Registered: Nov, 2007

Re: search patterns and parse data into dict Posted: Nov 5, 2007 10:11 AM
Reply to this message Reply
Oooooooh... Sounds like an ACM practice problem. You should formulate and post the expected input file, and how you expect the dictionary (or output file) to look from that input. Im not quite sure what your asking.

Flat View: This topic has 1 reply on 1 page
Topic: assign values to members of class objects Previous Topic   Next Topic Topic: how to start

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use