Python Forum
Pytables : Printing without special characters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pytables : Printing without special characters
#1
I create a dataset containing some file information (characters). Aim is to print the content. Using info[:] also prints special characters like \n, b. Is there a way to avoid print of these special characters? I know how to use a for loop and decode line-by-line, but that occupies extra space and looks clumsy in my code. Is there a clean/short alternative?

info = f.create_earray(f.root, "dataset_0", atom=tables.StringAtom(itemsize=200), shape=(0, ))
print(info[:]) # 

# reading line by line:
for i in range(info.shape[0]):  
    print(info[i].decode())
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deleting characters between certain characters stahorse 7 1,075 Jul-03-2023, 12:59 AM
Last Post: Pedroski55
  Automating PyTables Dataset Creation and Append Robotguy 1 1,767 Oct-18-2020, 08:35 PM
Last Post: jefsummers
  Reading a table generated using PyTables Robotguy 1 1,500 Sep-18-2020, 03:10 PM
Last Post: Larz60+
  Pytables: Reducing size of an appended Earray Robotguy 0 1,626 Aug-19-2020, 05:35 PM
Last Post: Robotguy
  Using Pytables to Sort Large Arrays? Robotguy 0 1,990 Aug-12-2020, 03:35 PM
Last Post: Robotguy

Forum Jump:

User Panel Messages

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