Use the following code, and do not forget the space in URLs should be converted to %20. You can run the code here.
import os
import urllib.request
def fetch_credit_card_data(url, directory, file_name):
if not os.path.isdir(directory):
os.makedirs(directory)
urllib.request.urlretrieve(url, directory+'/'+file_name)
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/00350/default%20of%20credit%20card%20clients.xls"
directory = 'directory'
file_name = 'credit_card.xls'
fetch_credit_card_data(url, directory, file_name)