def filename_from_url(url):
 if (not url.isValid()):
  return None
 pathname = posixpath.basename(url.path())
 if pathname:
  return pathname
 elif url.host():
  return (url.host() + '.html')
 else:
  return None

def filename_from_url ( url ) : if ( not url . isValid ( ) ) : return None pathname = posixpath . basename ( url . path ( ) ) if pathname : return pathname elif url . host ( ) : return ( url . host ( ) + '.html' ) else : return None
get a suitable filename from a url .