应用错误收集 您所在的位置:网站首页 shell如何遍历文件列表 应用错误收集

应用错误收集

#应用错误收集| 来源: 网络整理| 查看: 265

3 个答案:

答案 0 :(得分:1)

Python为此目的提供了一些名为.pth的文件。

答案 1 :(得分:1)

您可以从shell中读取路径:

path = raw_input( "Insert path: ") # It will display "Insert path and will return the string entered into variable 'path'

或使用文件:

f = fopen( "", "r" ) #open the file in reading-mode list_of_lines = f.readlines() # read all the lines and put them in a list f.close() # closes the file for i in range( len(list_of_lines ) ): #cleaning from newline characters list_of_line[i] = list_of_line[i].strip()

现在,在list_of_lines列表中,您将从文件中读取所有行...例如,现在您可以:

for i in range(len(list_of_lines)): sys.path.append( list_of_lines[i] )

希望有所帮助:)

答案 2 :(得分:0)

而不是替换你可以sys.path.insert(0, "./build/lib.linux-x86_64-2.4")而不是那条路径。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有