Python os.mkfifo() Method

Python OS File/Directory Methods


Overview

The os.mkfifo() method is used to create a pipe at the specified path and set the permission mode. The default mode is 0666 (octal).

Syntax

mkfifo()The method syntax is as follows:

os.mkfifo(path[, mode])

Parameters

  • path-- The directory to be created

  • mode-- The numeric permission mode to set for the directory

Return Value

This method has no return value.

Example

The following example demonstrates the use of the mkfifo() method:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os, sys

# 创建的目录
path = "/tmp/hourly"

os.mkfifo( path, 0644 )

print "路径被创建"

The output of the above program is:

The path was created

Python OS File/Directory Methods

Other Extensions