Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Manipulating Data from html file and converting to .txt  RSS feed

 
Jeff Sak
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write a program that takes the source code from a html file and manipulates the data. So far, I have been able to write code to strip all html code and output onto a .txt file which is great. But I am struggling with the next part of my code. I am trying to model a class for entertainment review (the website I am taking info from is a blog about movie, play, and film reviews). I want to be able to make it organized so that the new .txt file will be sorted by the type of entertainment they watched (i.e. film, play, etc.), then display the cost of the movie and also show whether it was recommended or not. I have attached what some of the source code looks like below. I really don't even know where to start here, or how to manipulate the data to be organized. I feel I am supposed to make a constructor that takes each line of data, but I could be wrong.


<p>Tonight I saw <em class="film">You Will Meet a Tall Dark Stranger,</em> a film by Woody Allen but without him anywhere in it. I'd say it's okay to see once, but not critical.... lots of intertwining relationship stories with endings you can never anticipate.
</p><p>
Today I saw <em class="play">Vanya and Sonia and Masha and Spike</em> at the Santa Paula Theater Center. <!-- $18. --> This is a funny play, definitely worth seeing, and the performances were good. There's one scene near the end where a woman receives a phone call from "Joe." She goes through all kinds of emotions and really, really pulls it off.
</p><p>
Tonight I saw <em class="film">Ant-Man</em>  at the Mall. <!-- $8 --> Chris is going to watch this again, catching the very next showing (with Bob). I don't think it's worth seeing a second time.
</p><p>
Tonight I saw <em class="film">The Imitation Game</em> at Village Twin. <!-- $8 -->
</p><p>
 
Tim Moores
Saloon Keeper
Posts: 3511
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would make more sense to post the TXT file, since that is what you're working with. Also post the expected output, so we know what the result should look like.
 
Dave Tolls
Ranch Hand
Posts: 2504
27
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!