Python Forum

Full Version: code wanted: finding absent characters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have a set of files. references to directories mean all files in the subtree that directory is the top of. references to files mean just that file. references to symlinks mean follow that symlink to a new reference.

what i want to do with this set of files is determine what set of characters are in none of those files. the use case is to find characters usable as separators with this data. for example, if the data has no commas, then i can use a comma to make a character separated multi-column list (speadsheet) from any parts of this data.
For the first question, you can write a generator that walks the tree and follows symbolic links (beware of cycles in the DAG), and generates all the paths to the files. A second function will open the files and build a set of all the characters in the files. It looks quite simple.

For the use case, note that you can make a csv spreadsheet by quoting the data. Then you don't need to worry if there are commas in the files.
(Mar-25-2018, 03:16 PM)Gribouillis Wrote: [ -> ]For the use case, note that you can make a csv spreadsheet by quoting the data. Then you don't need to worry if there are commas in the files.
i don't know how this is done. is there a module that does this and knows how to pick some other character?