How to remove from print nulls outputs (Python 3)
Question:
this is my first question about programing. I have problem with loading date from vmem file. Try to print all chars in long string like: fkvjdhde.
Now its look like:
my output from f print
My idea is create outputs with understand ascii symbols i[0:7] line after line. How to remove all chars what I don’t want (NULLs, space and more)? Thanks for help!
def remove(x):
return x.replace('n', "")
return x.replace('x00', "")
return x.replace('x01', "")
with codecs.open('file.vmem', 'r', encoding='utf-8', errors='ignore') as fdata:
for i in fdata:
letsClean = remove(i)
counting = 1
a = 0
b = 8
for i in letsClean:
a += 1
b += 1
takie = letsClean[a:b]
print(takie)
Answers:
Keep what you want to keep.
keep = ''.join(chr(c) for c in range(32,127))
def cleanup(x):
return ''.join(k for k in x if k in keep)
this is my first question about programing. I have problem with loading date from vmem file. Try to print all chars in long string like: fkvjdhde.
Now its look like:
my output from f print
My idea is create outputs with understand ascii symbols i[0:7] line after line. How to remove all chars what I don’t want (NULLs, space and more)? Thanks for help!
def remove(x):
return x.replace('n', "")
return x.replace('x00', "")
return x.replace('x01', "")
with codecs.open('file.vmem', 'r', encoding='utf-8', errors='ignore') as fdata:
for i in fdata:
letsClean = remove(i)
counting = 1
a = 0
b = 8
for i in letsClean:
a += 1
b += 1
takie = letsClean[a:b]
print(takie)
Keep what you want to keep.
keep = ''.join(chr(c) for c in range(32,127))
def cleanup(x):
return ''.join(k for k in x if k in keep)