[PYTHON] Check if it is Unix in the scripting language

Uname etc. may be inconvenient. So check for the existence of / dev / null. Also make sure it is a device just in case. In principle, it can be applied to scripting languages other than Python.


from stat import S_ISCHR
from os import stat

def unixcheck():
        return S_ISCHR(stat('/dev/null').st_mode)
        return False

Recommended Posts

Check if it is Unix in the scripting language
Check if it is Unix in the scripting language
Check if the string is a number in python
Check if the configuration file is read in an easy-to-understand manner
Delete a particular character in Python if it is the last
Check if the URL exists in Python
[Golang] Check if a specific character string is included in the character string
[Short note] In matplotlib, nothing is displayed even if I show it → Check the backend setting
If the conda environment is strange, let's put it back in mac
Check if the characters are similar in Python
In bash, "Delete the file if it exists".
Even if the development language is changed to python3 in Cloud9, version 2 is displayed in python --version
Determine if an attribute is defined in the object
Check if the LAN cable is disconnected on Linux
How to use any or all to check if it is in a dictionary (Hash)
How to check in Python if one of the elements of a list is in another list
A note for embedding the scripting language in a bash script
Note 2 for embedding the scripting language in a bash script
[Pandas] If the first row data is in the header in DataFrame
If you want Python completion in VS Code, Microsoft Python Language Server is the best story
[Blender] Script to check if the selected one is a mesh
In the python dictionary, if a non-existent key is accessed, initialize it with an arbitrary value
Check if the password hash generated by PHP matches in Python
Determine if the string is formatable
Switch the language displayed in Django 1.9
Determine if the library is installed.
I made a function to check if the webhook is received in Lambda for the time being
Check the data summary in CASTable
The story that inheritance behavior is quite different in each language
Check if there is a specific symbol in the executable file and its dependent libraries (simplified version)
[Python] Sweet Is it sweet? About suites and expressions in the official documentation
If you get a no attribute error in boto3, check the version
The most sought after programming language in 2020
Check the behavior of destructor in Python
Django ~ Let's display it in the browser ~
Determine if the gold coin is genuine
[Unix] What is the zombie process / orphan process?
What is "mahjong" in the Python library? ??
When the target is Ubuntu 16.04 in Ansible
Looking back on 2016 in the Crystal language
Draw graphs in the programming language Julia
Check if it was run as root
Find it in the procession and edit it
Is there NaN in the pandas DataFrame?
The date is displayed incorrectly in matplotlib.
[For Numba beginners] It is better to set nopython = True to check if the speedup is realized (for version 0.50.0 or earlier)
I created a script to check if English is entered in the specified position of the JSON file in Python.
If branch depending on whether there is a specific element in the list
In Python, change the behavior of the method depending on how it is called
[OpenCV] When you want to check if it is read properly with imread
Differences in the behavior of each LL language when the list index is skipped
[For beginners] Unexpected behavior if "\" is included when setting the path in Python
If an exception occurs in the function, it will be transmitted to the caller 2
If an exception occurs in the function, it will be transmitted to the caller 1
Pipfile is not created in the current directory
100 Language Processing Knock UNIX Commands Learned in Chapter 2
Create an executable file in a scripting language
What is wheezy in the Docker Python image?
Python> Run-time argument> Check if -d is attached
About the difference between "==" and "is" in python
Determining if there are birds in the image