Python3查找指定字符串在文件中的行数位置并输出 #! /usr/local/bin/python3 # -*- coding:UTF-8 -*- import os # 确定当前操作系统路径分隔符 def path(): global pathSeparator osName = os.name if osName == "posix": pathSeparator = "/" elif osName == "nt": pathSeparator = "\\" # 主程序 def main