Python Forum
Read a folder with a multiple files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read a folder with a multiple files
#6
Please read previous answers once again. You have got answer why you get only one name back and how to deal with it.

From lxml FAQ:

Quote:Take a look at the XML specification, it's all about byte sequences and how to map them to text and structure. That leads to rule number one: do not decode your XML data yourself. That's a part of the work of an XML parser, and it does it very well. Just pass it your data as a plain byte stream, it will always do the right thing, by specification.

This also includes not opening XML files in text mode. Make sure you always use binary mode, or, even better, pass the file path into lxml's parse() function to let it do the file opening, reading and closing itself. This is the most simple and most efficient way to do it.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Function returning elements in a list - by NewBeie - May-03-2019, 11:17 AM
Read a folder with a multiple files - by NewBeie - May-06-2019, 06:54 AM
RE: Function returning elements in a list - by perfringo - May-06-2019, 07:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to generating multiple json files using python script dzgn989 4 301 May-10-2024, 03:09 PM
Last Post: deanhystad
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 668 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  python convert multiple files to multiple lists MCL169 6 1,706 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Rename files in a folder named using windows explorer hitoxman 3 822 Aug-02-2023, 04:08 PM
Last Post: deanhystad
  splitting file into multiple files by searching for string AlphaInc 2 1,003 Jul-01-2023, 10:35 PM
Last Post: Pedroski55
  Rename all files in a folder hitoxman 9 1,654 Jun-30-2023, 12:19 AM
Last Post: Pedroski55
  Merging multiple csv files with same X,Y,Z in each Auz_Pete 3 1,282 Feb-21-2023, 04:21 AM
Last Post: Auz_Pete
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 1,010 Feb-15-2023, 05:34 PM
Last Post: zsousa
  How to read in mulitple files efficiently garynewport 3 965 Jan-27-2023, 10:44 AM
Last Post: DeaD_EyE
  Find duplicate files in multiple directories Pavel_47 9 3,356 Dec-27-2022, 04:47 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020