Depends on what you know about your url and exactly what you're tryinh to do. If you know that it will always end in '.com' (or '.net' or '.org') then
url=url[:-4]
is the quickest solution. If it's a more general URLs then you're probably better of looking into the urlparse library that comes with python.
If you on the other hand you simply want to remove everything after the final '.' in a string then
url.rsplit('.',1)[0]
will work. Or if you want just want everything up to the first '.' then try
url.split('.',1)[0]