473,511 Members | 17,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hostname

Hi
Iam new in Python.
I want to know for my first Project in Python how i can get the
Hostname from a URL?
Thanks for Help

Jan 29 '06 #1
3 1788
jo*************@googlemail.com <jo*************@googlemail.com> wrote:
Hi
Iam new in Python.
I want to know for my first Project in Python how i can get the
Hostname from a URL?
import urlparse
urlparse.urlsplit('http://foo.bar.com/zapzap') ('http', 'foo.bar.com', '/zapzap', '', '')


As you may notice, the hostname is the second item of the tuple result.
Thanks for Help


You're welcome.
Alex
Jan 29 '06 #2
Wow! This was a fast answer and it works.

Jan 29 '06 #3
jo*************@googlemail.com <jo*************@googlemail.com> wrote:
Wow! This was a fast answer and it works.


That's why we used to joke about Guido's time machine: somebody would
express a need (sometimes phrased as a suggestion for an enhancement),
and Guido would zip back in time and implement the needed functionality
_before_ the request...;-)
Alex
Jan 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2520
by: Claus van de Vlierd | last post by:
Hello , a) in the following script (under RedHat AS3 with PHP 4.3.2 ) I make a "DB::connect" to an existing "mysql" database named "docu_files_of_cvdv" . The strange thing is : it works --...
2
38975
by: Lukas Schnieper | last post by:
Hi How can i get the hostname of my Linux PC? I tried os.system('hostname') but i cant save the hostname in a variable like hostname = os.system('hostname') thanks Lukas Schnieper
2
9810
by: Tim Veldhuizen | last post by:
Hi all! I'm attempting at writing a networked program. It is going to be a threaded irc server in c++ using almost nothing but oop code. And it needs to know the full hostname of the users that...
2
5596
by: James M. | last post by:
I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup with NLB (single Affinity, also using SQLServer session state) that are hosting a few .NET ASP web applications under the Default Website...
3
4784
by: Microlong® | last post by:
Currently, I want to get the IP address from giving hostname in the Active Server Page. I know the hostname, I want to get the IP address via hostname in an ASP page. -- Developer QA Dashboard...
3
3772
by: HiChetu | last post by:
I have a host which has two NIC cards; one configured for LAN connections, and another for external connections. Say the ip address are 1) x.x.x.x - for LAN 2) y.y.y.y - for external ...
0
1504
by: James M via .NET 247 | last post by:
(I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup withNLB (single Affinity, also using SQLServer session state) thatare hosting a few .NET ASP web applications under the DefaultWebsite in...
6
3580
by: Eric Rechter | last post by:
Hi, I only want to display the provider name from a hostname, so I need to divide the string to take only de characters from after the before last dot. For example: ...
2
5247
by: slinkp | last post by:
Can anybody explain this one? pw@kermit ~ $ python Python 2.4.3 (#1, Jul 27 2006, 13:07:44) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most...
3
7207
by: Mark Delaney | last post by:
When using the MS SQL 2005 JDBC driver, I now need to have the DNS name resolution to the client correctly set up. If not I get the following error: SQLState: 08S01 SQLError: 0 Message:...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.