本文整理汇总了Python中os.O_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python os.O_TEXT属性的具体用法?Python os.O_TEXT怎么用?Python os.O_TEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类os
的用法示例。
在下文中一共展示了os.O_TEXT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wtrf
# 需要导入模块: import os [as 别名]
# 或者: from os import O_TEXT [as 别名]
def wtrf():
if sys.platform != "win32":
wt = int(os.environ['MYHDL_TO_PIPE'])
rf = int(os.environ['MYHDL_FROM_PIPE'])
else:
wt = msvcrt.open_osfhandle(int(os.environ['MYHDL_TO_PIPE']), os.O_APPEND | os.O_TEXT)
rf = msvcrt.open_osfhandle(int(os.environ['MYHDL_FROM_PIPE']), os.O_RDONLY | os.O_TEXT)
return wt, rf
示例2: create_file_from_handle
# 需要导入模块: import os [as 别名]
# 或者: from os import O_TEXT [as 别名]
def create_file_from_handle(handle, mode="r"):
"""Return a Python :class:`file` arround a windows HANDLE"""
fd = msvcrt.open_osfhandle(handle, os.O_TEXT)
return os.fdopen(fd, mode, 0)
示例3: open_handle
# 需要导入模块: import os [as 别名]
# 或者: from os import O_TEXT [as 别名]
def open_handle(handle, mode):
flags = 0
if 'w' not in mode and '+' not in mode:
flags |= os.O_RDONLY
if 'b' not in mode:
flags |= os.O_TEXT
if 'a' in mode:
flags |= os.O_APPEND
return msvcrt.open_osfhandle(handle, flags)
示例4: create_file_from_handle
# 需要导入模块: import os [as 别名]
# 或者: from os import O_TEXT [as 别名]
def create_file_from_handle(handle, mode="r"):
"""Return a Python :class:`file` around a ``Windows`` HANDLE"""
flags = os.O_BINARY if "b" in mode else os.O_TEXT
fd = msvcrt.open_osfhandle(handle, flags)
kwargs = {}
if windows.pycompat.is_py3 and flags == os.O_TEXT:
# Buffering, encoding
args = (100, "ascii")
else:
# Buffering
args = (0,)
# In py2 os.fdopen do not accept kwargs
return os.fdopen(fd, mode, *args)