Python Forum
code wanted: finding absent characters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code wanted: finding absent characters
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
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.
Reply
#3
(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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ttp template not working when values are absent in some scenarios jss 0 342 Oct-31-2023, 09:01 PM
Last Post: jss
  (OpenCV) Help to improve code for object detection and finding center of it saoko 0 1,159 May-14-2022, 05:34 PM
Last Post: saoko
  Regex not finding all unicode characters tantony 3 2,234 Jul-13-2021, 09:11 PM
Last Post: tantony
  Remove escape characters / Unicode characters from string DreamingInsanity 5 13,420 May-15-2020, 01:37 PM
Last Post: snippsat
  code for finding a cables crossed the bondary of the city spider_pytthon 8 3,471 Dec-24-2019, 07:23 AM
Last Post: spider_pytthon
  I need help finding an error in this code I have Tacnoblode 1 2,654 Jul-18-2018, 05:51 AM
Last Post: buran
  Trouble finding Python code Larz60+ 5 4,291 Jun-02-2017, 01:30 PM
Last Post: sparkz_alot
  'string index out of range' error when code replaces characters Ivan 1 3,863 Mar-04-2017, 05:04 PM
Last Post: Ivan
  Finding dead code Ofnuts 6 8,464 Dec-20-2016, 09:00 PM
Last Post: wavic
  Finding Special Characters in a String ATXpython 4 19,383 Sep-30-2016, 10:08 PM
Last Post: ATXpython

Forum Jump:

User Panel Messages

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