#!/usr/local/bin/python3

from sys import argv, exit
from urllib.request import urlopen

if len(argv[1]) != 4:
    print('Неправильно введен PDB-код.')
    exit(0)

a = argv[1] + '.pdb'
file = open(a, 'w')

site = urlopen('https://files.rcsb.org/view/{}.pdb'.format(argv[1]))
b = site.readline()
for b in site:
    file.write(b.decode())

file.close()

