Use the descriptively-named function socket.getfqdn()
:
>>> import socket >>> socket.getfqdn() 'phxdbx45.phx.host.com'
Related Posts:
- How can I use Python to get the system hostname?
- What does the host name “ww8” stand for in URLs
- bash: pip: command not found
- Function for Factorial in Python
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- Writing a pandas DataFrame to CSV file
- deleting file if it exists; python
- Python Linked List
- How to print without a newline or space
- Error: ‘int’ object is not subscriptable – Python
- Does Python have a ternary conditional operator?
- How do I install opencv using pip?
- How do I compare two strings in python?
- Purpose of “%matplotlib inline”
- Curve curvature in numpy
- How do I update Anaconda?
- TypeError: ‘str’ object is not callable (Python)
- Dijkstra’s algorithm in python
- python – how to get the data from an plt.imshow()?
- How to create a GUID/UUID in Python
- What are data classes and how are they different from common classes?
- Tensorflow import error: No module named ‘tensorflow’
- Python random function
- Converting NumPy array into Python List structure?
- How do I upgrade to Python 3.6 with conda?
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- Plot logarithmic axes with matplotlib in python
- Arrays used as indices must be of integer (or boolean) type
- python pip – install from local dir
- Are static class variables possible in Python?
- Why am I getting “LinAlgError: Singular matrix” from grangercausalitytests?
- How does the @property decorator work in Python?
- ‘method’ object is not subscriptable. Don’t know what’s wrong
- How to remove punctuation in python?
- How do I copy a file in Python?
- EOFError: Ran out of input
- Type error: cannot convert the series to
- Reading a binary file with python
- Python function global variables?
- How can I convert a character to a integer in Python, and viceversa?
- What’s the difference between %s and %d in Python string formatting?
- initialize a numpy array
- error: Unable to find vcvarsall.bat
- ‘str’ object has no attribute ‘decode’. Python 3 error?
- AttributeError: Module Pip has no attribute ‘main’
- django:django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet
- Can I force pip to reinstall the current version?
- Removing pip’s cache?
- How to get the current time in Python
- Improve subplot size/spacing with many subplots in matplotlib
- Can I run Keras model on gpu?
- How to check whether a pandas DataFrame is empty?
- Convert columns to string in Pandas
- How can I use numpy.correlate to do autocorrelation?
- How to check if a string is a substring of items in a list of strings?
- How to index into a dictionary?
- Find how many connected groups of nodes in a given adjacency matrix
- What does `<>` mean in Python?
- Add a new item to a dictionary in Python
- reducing number of plot ticks
- How can I add new keys to a dictionary?
- Convert pandas data frame to series
- Decorators with parameters?
- How do I get a python program to do nothing?
- inserting characters at the start and end of a string
- How can I create a text input box with Pygame?
- npm – “Can’t find Python executable “python”, you can set the PYTHON env variable.”
- How can I print variable and string on same line in Python?
- SettingWithCopyWarning even when using .loc[row_indexer,col_indexer] = value
- Append a tuple to a list – what’s the difference between two ways?
- No module named Image
- How to fix “TypeError: len() of unsized object”
- ValueError: Unknown projection ‘3d’ (once again)
- Difference between len() and .__len__()?
- Good ways to “expand” a numpy ndarray?
- Python data structure sort list alphabetically
- TypeError: ‘numpy.float64’ object does not support item assignment
- Python/Django: log to console under runserver, log to file under Apache
- TypeError: unsupported format string passed to list.__format__
- Getting “socket.error: [Errno 61] Connection refused” python paramiko
- python setup.py uninstall
- What is the difference between __str__ and __repr__?
- How often does python flush to a file?
- How to open every file in a folder
- Python iteration over non-sequence
- How do I convert a string to a double in Python?
- _csv.Error: field larger than field limit (131072)
- How do I rotate an image around its center using Pygame?
- How can I copy a Python string?
- Issue with virtualenv – cannot activate
- Telling Python to save a .txt file to a certain directory on Windows and Mac
- Spell Checker for Python
- TypeError: coercing to Unicode: need string or buffer, int found
- How to fix SSL issue SSL_CTX_use_certificate : ca md too weak on Python Zeep
- Paramiko’s SSHClient with SFTP
- Package libffi was not found in the pkg-config search path REDHAT6.5
- Line is too long. Django PEP8
- TypeError: zip argument #2 must support iteration
- CS231n: How to calculate gradient for Softmax loss function?
- How to create a new database using SQLAlchemy?