python - open all documents in a folder and make them in a list -


I want to open all the documents in a folder and give each document a list element such as: ["Dc1 "," Doc2 "," doc3 ", ...]

 For the  file in DeepPath, DIR, OS Walk ('file path'): In the final match for filename. Text (files, '* - *'): Open as text (with OS path.join (dirpath, filename)): lines = text. Rolledline () print lines   

However, it only creates all the contents of documents in a string.

Please tell me how to reach the expected result.

  docs = [] Os.path.join (dirpath, filename)): docs.append (text.read ()) print docs    

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -