Python method mkfifo() create a FIFO named path with numeric mode. The default mode is 0666 (octal). The current umask value is first masked out.
Following is the syntax for mknod() method:
os.mknod(filename[, mode=0600[, device=0]])
This method does not return any value.
The following example shows the usage of mknod() method.
# !/usr/bin/python import os import stat filename = '/tmp/tmpfile' mode = 0600'stat.S_IRUSR # filesystem node specified with different modes os.mknod(filename, mode)
Let us compile and run the above program, this will create a simple file in /tmp directory with a name tmpfile:
-rw-------. 1 root root 0 Apr 30 02:38 tmpfile
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.