#!/usr/bin/python
"""
This simple script can be used to download
pdb files directly from internet
usage: python getpdb.py <pdbids>
example: python getpdb.py 3ZBQ 4HXP 4HXM 4B8F
"""
import urllib
url = "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId="
from sys import argv
for i in argv[1:]:
pdbid = url+str(i)
open( i+".pdb", "w" ).write( urllib.urlopen(pdbid).read() )
print i+".pdb"