The different countries don't use a uniform scheme.  For example, .uk 
has a two-letter component (.co .ac, etc), but other countries do not.

I suppose the exact answer to your question ("how do I parse these 
domains") depends on why it is you are trying to parse them.  What 
information are you trying to get from the domain?

--Ned.
http://nedbatchelder.com/blog

Dave Fowler wrote:
> This doesn't have a lot to do with django, but python and web
> programming.
>
> I'm having an issue parsing the sub domain from a lot of non-US urls.
> In the US the format is always  subdomain.domain.sufix or
> domain.sufix.  Easy to parse.
>
> In the uk for example though the format is
>
> subdomain.domain.co.uk or
> domain.co.uk
>
> My issue is that i'm parsing the domain.co.uk like us urls and its
> parsing the domain to be "co.uk" not domain.co.uk!
>
> example:  getDomain('bbc.co.uk') returns 'co.uk'
>
> Any one know of a standard protocol for parsing these urls, or do I
> have to find all the unique instances of co.uk, or co.nz etc.
>
> Thanks
>
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to