[Tutor] Fwd: File handling Tab separated files

2018-04-19 Thread Brian Lockwood

>> 
>> Here are some fixes
>> 
>> filename is a variable and hence should not be in quotes.
>> file_ is then called ‘f’ on the next line.
>> The indenting is a bit wrong but this may just be your email.
>> 
>> the line read_data … should be followed by something that appends the 
>> read_data to “object” which should be declared earlier.
>> 
>>> On 19 Apr 2018, at 09:45, Niharika Jakhar >> > wrote:
>>> 
>>> Hi
>>> I want to store a file from BioGRID database (tab separated file, big data)
>>> into a data structure(I prefer lists, please let me know if another would
>>> be better) and I am trying to print the objects.
>>> Here’s my code:
>>> class BioGRIDReader:
>>>   def __init__(self, filename):
>>>   with open('filename', 'r') as file_:
>>>   read_data = f.read()
>>>   for i in file_ :
>>>   read_data = (i.split('\t'))
>>>   return (objects[:100])
>>> 
>>> a = BioGRIDReader
>>> print (a.__init__(test_biogrid.txt))
>>> 
>>> 
>>> 
>>> 
>>> Here's what the terminal says:
>>> Traceback (most recent call last):
>>> File "./BioGRIDReader.py", line 23, in 
>>>   print (a.__init__(test_biogrid.txt))
>>> NameError: name 'test_biogrid' is not defined
>>> 
>>> The file named test_biogrid.txt do exist in the same folder as this program.
>>> 
>>> I am unable to go further with this code. Kindly help me out.
>>> 
>>> 
>>> Thanks and regards
>>> NIHARIKA
>>> ___
>>> Tutor maillist  -  Tutor@python.org 
>>> To unsubscribe or change subscription options:
>>> https://mail.python.org/mailman/listinfo/tutor 
>>> 
>> 
> 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Extract main text from HTML document

2018-05-06 Thread Brian Lockwood
Two things. The first thing is that you can download the page as a string
and delete a everything between tags. Secondly It might be worth looking at
Udacity cs101 as this course is all about a search engine.
On Sat, 5 May 2018 at 22:27, Simon Connah  wrote:

> Hi,
>
> I'm writing a very simple web scraper. It'll download a page from a
> website and then store the result in a database of some sort. The
> problem is that this will obviously include a whole heap of HTML,
> JavaScript and maybe even some CSS. None of which is useful to me.
>
> I was wondering if there was a way in which I could download a web
> page and then just extract the main body of text without all of the
> HTML.
>
> The title is obviously easy but the main body of text could contain
> all sorts of HTML and I'm interested to know how I might go about
> removing the bits that are not needed but still keep the meaning of
> the document intact.
>
> Does anyone have any suggestions on this front at all?
>
> Thanks for any help.
>
> Simon.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] i really need help

2018-05-30 Thread Brian Lockwood
 If you only have the command line.  Use the command line to navigate the
folder where your script is. Then use the command python Followed by your
scrutiny

On Wed, 30 May 2018 at 17:13, erich callahana  wrote:

>
>
> I need to know how to access the window where in the menu at the top it
> says run and that’s where I can test my script, basically I have no idea
> how to test my script
>
> Thankyou
>
> Kind Regards
>
> Erich.C
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor