S
subhabrata.iisc
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.
(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.
(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?
(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:
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?
If someone can help me.
Best Regards,
Subhabrata Banerjee,
Indian Institute of Science,
Bangalore,
India.
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.
(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.
(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?
(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:
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?
If someone can help me.
Best Regards,
Subhabrata Banerjee,
Indian Institute of Science,
Bangalore,
India.