hi friends

i am a beginner in python programming. I have written code to download 16 pdf files. I am getting the pdf file but I am unable to open the file it is showing error. please help me.

import re,urllib
url="http://www.ncbi.nlm.nih.gov/books/NBK16"
id1=[30,24,25,28,22,23,14,33,21,29,16,27,18,20,17,26]
j=1;

for i in id1:
address= url+str(i)+'/pdf/ch'+str(j)+'.pdf'
print address
handle=urllib.urlretrieve(address,'ch'+str(j)+'.pdf')
print "HCV book ch"+str(j)+".pdf is succefully downloaded"
j+=1

----------

-ordi- commented: Hi! Please make new thread for youre problem, thanks! +0

Recommended Answers

All 3 Replies

hi friends
please help me out of that problem my previous code is working for other websites i am able to download other pdf files. I want to know why it is not working for this site. when i copy and paste this site to web browser i am able to download the pdf files. why it is not working when i code this.
please give a solution to this problem
even i tried with wget it is giving error 403: forbidden

If you know a good project, please post it here. If you have questions, start your own thread and don't clutter the sticky.

I don't have any intension to confuse anyone its my doubt about handling PDF files. I am new to this forum and python programming also.
I will post my questions as a new thread after this. Even if you typed your suggestion in black text i would have accept it and try to learn how to post new threads.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.