Python Forum

Full Version: Pytables : Printing without special characters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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())