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


Python Analyzer.analyze_file方法代码示例

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


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

示例1: len

# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import analyze_file [as 别名]
Created by Patrick Flanagan on 2/20/2015

This is the main process. It passes the name of the file to be processed
to the Analyzer class. The main processes are to have the file opened, analyzed, and
then closed. The analysis will also be written to a log file.

"""
import sys
import os.path
from Analyzer import Analyzer

# input should be one file name

if len(sys.argv) != 2:
    print "Incorrect number of arguments given. Program is expecting exactly one argument."
    print "The argument should be a name of a file at the base location of the program."

else:
    if not os.path.isfile(sys.argv[1] + ".mal"):
        print "Argument given could not be found at the base-level of the program."
        print "Check if file exists and if the name matches the given argument."

    else:
        analyzer = Analyzer(sys.argv[1])

        analyzer.initialize_log_file()
        analyzer.analyze_file()

        analyzer.input_file.close()
        analyzer.output_file.close()
开发者ID:pflanny2,项目名称:MAL-Syntax-Checker,代码行数:32,代码来源:Main.py


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