PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

subhabrata.iisc at hotmail.com subhabrata.iisc at hotmail.com
Wed Apr 9 10:12:55 CEST 2008


Dear Sir,
Thank you for taking time out to answer.
For (i) It is happening. On trial it ran so well that when on
demonstration I got questions from tester, I felt amazed.
For (ii) For answer no.2 I'll check str.find.
For (iii) Well I said you most of crawler's algorithm. It works like a
MS IE synchronizer, if not better. The URLs are taken in a file the
file is read the URL's taken and put into
urllib.urlopen("http://.....") as it crawls the result is stored in a
text file, from the text file the garbage is cleaned, the sublinks are
extracted, the result files are again cleaned and sublinks extracted
we carry on this till we reach an optimum. For n-gram calculaion of
sublinks I am using numpy and decimal and pattern search in a unique
combination, it has no prob but this IDLE is getting no response if I
port more than 10 sites. I am willing to put 100 to 1000 URLs at one
go. If you know anyone in Bangalore, India expert in python kindly
send him across I can show him the problem in my machine and Indian
Institute of Science(IISc-locally known as TATA INSTITUTE) is a
distinguished place.Any one should know it.
I am in no mood of doing a joke.
Best Regards,
Subhabrata Banerjee.

Steve Holden wrote:
> subhabrata.iisc at hotmail.com wrote:
> > I am using Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.
> > 1310 32 bit (Intel)] on win32 with IDLE 1.2.1
> > My O/S is Windows XP SP2 I use 512 MB RAM.
> > I am encountering the following problems:
> > (i) a1=1
> >     a2=2
> >     a3=a1+a2
> >     print a3
> > # The result is coming sometimes as 3 sometimes as vague numbers.
> >
> Sorry, this just isn't true. There is no known implementation for which
> 1+2 does not equal 3.
>
> > (ii) x1="Bangalore is called the Silicon Valley of India"
> >     x2="NewYork"
> >     x3=x1.find(x2)
> >     print x3
> > # The result of x3 is coming as -1 as well as +ve numbers.
> >
> Presumably you get -1 when the substring isn't found. Look at the
> documentation of str.find() to discover *why* this happens.
>
> > (iii) I have been designing one crawler using "urllib". For crawling
> > one web page it is perfect. But when I am giving around 100 URLs by
> > and their links and sublinks the IDLE is not responding. Presently I
> > have been running with 10 URLs but can't it be ported?
> >
> Not enough information. "I have a program, please tell me waht is wrong
> with it" overtaxes even this group's psychic abilities.
>
> > (iv) I have designed a program with more than 500 if elif else but
> > sometimes it is running fine sometimes it is giving hugely erroneous
> > results, one view of the code:
>
> I am afraid that for code like this "designed" is far too kind a term. I
> would have suggested "thrown together".
>
> On what analysis of your problem was this solution based?
>
> > elif a4==3:
> >         print "YOU HAVE NOW ENTERED THREE WORDS"
> >         if a3[0] not in a6:
> >             if a3[1] not in a6:
> >                 if a3[2] not in a6:
> >                     print "a3[0] not in a6, a3[1] not in a6, a3[2] not
> > in a6"
> >                 elif a3[2] in a6:
> >                     print "a3[0] not in a6, a3[1] not in a6, a3[2] in
> > a6"
> >                 else:
> >                     print "NONE3.1"
> >             elif a3[1] in a6:
> >                 if a3[2] not in a6:
> >                     print "a3[0] not in a6, a3[1] in a6, a3[2] not in
> > a6"
> >                 elif a3[2] in a6:
> >                     print "a3[0] not in a6,a3[1] in a6, a3[2] in a6"
> >                 else:
> >                     print "NONE3.2"
> >             else:
> >                 print "NONE3.3"
> >         elif a3[0] in a6:
> >             if a3[1] not in a6:
> >                 if a3[2] not in a6:
> >                     print "a3[0] in a6, a3[1] not in a6, a3[2] not in
> > a6"
> >                 elif a3[2] in a6:
> >                     print "a3[0] in a6, a3[1] not in a6, a3[2] in a6"
> >                 else:
> >                     print "NONE3.4"
> >             elif a3[1] in a6:
> >                if a3[2] not in a6:
> >                    print "a3[0] in a6, a3[1] in a6, a3[2] not in a6"
> >                elif a3[2] in a6:
> >                    print "a3[0] in a6, a3[1] in a6, a3[2] in a6"
> >                else:
> >                    print "NONE3.5"
> >             else:
> >                 print "NONE3.6"
> >         else:
> >             print "NONE3.7"
> > Why it is behaving like that?
>
> Like what? You don't even say what results you expect, and only describe
> the results you *do* obtain as "hugely erroneous".
>
> I have a car. I have turned the ignition key but it fails to start.
> Please tell me what is wrong with it.
>
> regards
>   Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC              http://www.holdenweb.com/



More information about the Python-list mailing list