Heim  >  Fragen und Antworten  >  Hauptteil

Python aus Fileutils importiert FileUtils-Dateioperationen

Ich habe festgestellt, dass FileUtils zum Lesen von Dateien in einem Py-Skript verwendet wird, aber es wurde nicht in doc.python gefunden.
Ist das die API-Bibliothek von Apache? Wie soll ich es herunterladen und verwenden?

from fileutils import FileUtils

for line in FileUtils.getLines('result.txt'):
为情所困为情所困2711 Tage vor476

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-05-18 11:03:44

    这个应该是自己封装的package,不是python内置的
    针对文件操作python已经支持的很好了,如果你要对文件进行读取,你可以这样做:

    with open('result.txt', 'r') as f:
        for line in r:
            print line

    Antwort
    0
  • StornierenAntwort