I use urllib.urlopen()
in a function called urlopen_test()
. In this function I call urlopen twice,the first call is quite fast but not the second one. Anyone call help me figure out why?
BTW, I use line_profile
inspect every line in the function, following is the result.
Line # Hits Time Per Hit % Time Line Contents
5 @profile
6 def urlopen_test():
7 1 28690 28690.0 0.1 fh =urllib.urlopen('ftp://a.com/1.log')
8 1 58 58.0 0.0 print fh.read()
9
10 1 30027787 30027787.0 99.9 fh = urllib.urlopen('ftp://a.com/1.log')
11 1 40 40.0 0.0 print fh.read()