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


Groups > comp.lang.python > #112038

Re: Python text file fetch specific part of line

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From cs@zip.com.au
Newsgroups comp.lang.python
Subject Re: Python text file fetch specific part of line
Date Sat, 30 Jul 2016 12:46:55 +1000
Lines 38
Message-ID <mailman.40.1469848548.6033.python-list@python.org> (permalink)
References <1vulpbhu9j471fipgjchbd1o0165gdi248@4ax.com> <20160730024655.GA1902@cskk.homeip.net>
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
X-Trace news.uni-berlin.de sK/0ZhnMdiNDBRxuENVw4gXEzCaKTpHavDsFkS8MY0DQ==
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'subject:text': 0.04; 'subject:Python': 0.05; 'ignored': 0.05; 'json': 0.05; 'subject:file': 0.07; 'mutable': 0.09; 'xml.': 0.09; '>>on': 0.16; 'entirely.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'imdb': 0.16; "imdb's": 0.16; 'message-id:@cskk.homeip.net': 0.16; 'readable': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:io': 0.16; 'received:optusnet.com.au': 0.16; 'received:psf.io': 0.16; 'received:syd.optusnet.com.au': 0.16; 'section?': 0.16; 'simpson': 0.16; 'soup': 0.16; 'wrote:': 0.16; 'library,': 0.18; '>>>': 0.20; 'machine': 0.21; 'parse': 0.22; 'text,': 0.22; 'txt': 0.22; 'cheers,': 0.22; 'tried': 0.24; 'plain': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'raw': 0.27; 'data,': 0.27; 'format,': 0.27; 'url:software': 0.29; 'workaround': 0.29; 'task': 0.30; 'getting': 0.33; 'received:com.au': 0.33; 'file': 0.34; 'list': 0.34; 'text': 0.35; 'skip:> 10': 0.35; 'quite': 0.35; 'problem.': 0.35; 'but': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'charset:us-ascii': 0.37; 'application': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'from:no real name:2**0': 0.60; 'your': 0.60; 'skip:u 10': 0.61; 'avoid': 0.61; 'provide': 0.61; 'telling': 0.61; 'here.': 0.62; 'providing': 0.62; 'sample': 0.63; 'beautiful': 0.66; 'cameron': 0.66; 'here': 0.66; 'life': 0.67; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'obtained': 0.76; 'reply-to:addr:python.org': 0.84
Content-Disposition inline
In-Reply-To <1vulpbhu9j471fipgjchbd1o0165gdi248@4ax.com>
User-Agent Mutt/1.5.24 (2015-08-30)
X-Optus-CM-Score 0
X-Optus-CM-Analysis v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=kPLexIa+XrsL4mdc8kxeNA==:117 a=kPLexIa+XrsL4mdc8kxeNA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=cAmyUtKerLwA:10 a=vrnE16BAAAAA:8 a=pGLkceISAAAA:8 a=fGO4tVQLAAAA:8 a=0x2vhHYrAAAA:8 a=EmmQ-hcxAAAA:8 a=jf95d4iKAAAA:8 a=vcJ1V1U4veeICxgHUcAA:9 a=panPjDblSDwAiHPg:21 a=hgDS9aQxqVXQ-ewz:21 a=CjuIK1q_8ugA:10 a=D4O83h6meWPcCEhhlUO6:22 a=6kGIvZw6iX1k4Y-7sg4_:22 a=lhOh31jNlvCVFaAdFuvQ:22 a=jKTDQKFe_9NOjXLEHhtL:22 a=byyWrZqeQ9FgIiyAPqlG:22 a=H194ZH0Ca2A2-kryYjO5:22
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <20160730024655.GA1902@cskk.homeip.net>
X-Mailman-Original-References <1vulpbhu9j471fipgjchbd1o0165gdi248@4ax.com>
Xref csiph.com comp.lang.python:112038

Show key headers only | View raw


On 29Jul2016 18:42, Gordon Levi <gordon@address.invalid> wrote:
>cs@zip.com.au wrote:
>
>>On 28Jul2016 19:28, Gordon Levi <gordon@address.invalid> wrote:
>>>Arshpreet Singh <arsh840@gmail.com> wrote:
>>>>I am writing Imdb scrapper, and getting available list of titles from IMDB
>>>>website which provide txt file in very raw format, Here is the one part of
>>>>file(http://pastebin.com/fpMgBAjc) as the file provides tags like
>>>>Distribution  Votes,Rank,Title I want to parse title names, I tried with
>>>>readlines() method but it returns only list which is quite heterogeneous, is
>>>>it possible that I can parse each value comes under title section?
>>>
>>>Beautiful Soup will make your task much easier
>>><https://www.crummy.com/software/BeautifulSoup/>.
>>
>>Did you look at his sample data?
>
>No. I read he was "writing an IMDB scraper, and getting the available
>list of titles from the IMDB web site". It's here
><http://www.imdb.com/>.
>
>> Plain text, not HTML or XML. Beautiful Soup is
>>not what he needs here.
>
>Fortunately the OP told us his application rather than just telling us
>his current problem. His life would be much easier if he ignored the
>plain text he has obtained so far and started again using a Beautiful
>Soup tutorial.

Or bypass IMDB's computer unfriendliness and go straight to http://omdbapi.com/

You can have JSON directly from it, and avoid BS entirely. BS is an amazing 
library, but is essentially a workaround for computer-hostile websites: those 
not providing clean machine readable data, and only unstable mutable HTML 
output.

Cheers,
Cameron Simpson <cs@zip.com.au>

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


Thread

Python text file fetch specific part of line Arshpreet Singh <arsh840@gmail.com> - 2016-07-27 22:12 -0700
  Re: Python text file fetch specific part of line cs@zip.com.au - 2016-07-28 17:04 +1000
    Re: Python text file fetch specific part of line honeygne@gmail.com - 2016-08-01 23:55 -0700
  Re: Python text file fetch specific part of line Gordon Levi <gordon@address.invalid> - 2016-07-28 19:28 +1000
    Re: Python text file fetch specific part of line cs@zip.com.au - 2016-07-29 08:17 +1000
      Re: Python text file fetch specific part of line Gordon Levi <gordon@address.invalid> - 2016-07-29 18:42 +1000
        Re: Python text file fetch specific part of line cs@zip.com.au - 2016-07-30 12:46 +1000

csiph-web