当前位置: 首页>>代码示例>>Python>>正文


Python codecs.BOM_BE属性代码示例

本文整理汇总了Python中codecs.BOM_BE属性的典型用法代码示例。如果您正苦于以下问题:Python codecs.BOM_BE属性的具体用法?Python codecs.BOM_BE怎么用?Python codecs.BOM_BE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在codecs的用法示例。


在下文中一共展示了codecs.BOM_BE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bom

# 需要导入模块: import codecs [as 别名]
# 或者: from codecs import BOM_BE [as 别名]
def test_bom(self):
        print("\nTest: Remove BOM")
        hutil = MockUtil(self)
        files = [file for file in os.listdir('encoding') if 'bom' in file]
        for file in files:
            file_path = os.path.join('encoding', file)
            cs.preprocess_files(file_path, hutil)
            with open(file_path, 'r') as f:
                contents = f.read()
            if "utf8" in file:
                self.assertFalse(contents.startswith(codecs.BOM_UTF8))
            if "utf16_le" in file:
                self.assertFalse(contents.startswith(codecs.BOM_LE))
            if "utf16_be" in file:
                self.assertFalse(contents.startswith(codecs.BOM_BE)) 
开发者ID:Azure,项目名称:azure-linux-extensions,代码行数:17,代码来源:test_preprocess_file.py


注:本文中的codecs.BOM_BE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。