0
import sys
entrada = input("DLL Nome: ")
saida = entrada+"_output.txt"
file = bytearray(open(entrada, 'rb').read())
with open(saida, 'w') as output:
for count, byte in enumerate(file, 1):
output.write(f'{byte:#0{4}x},' + ('\n' if not count % 16 else ' '))
My mistake is:
output.write(f'{byte:#0{4}x},' + ('\n' if not count % 16 else ' '))
^
SyntaxError: invalid syntax
EDIT1: I’m using Python 3.7
To be seen, it’s okay - there’s a chance you typed a non-trintable character, of control, right in the middle - it causes a syntax error with no visible cause ( if that’s what that character didn’t come to when you pasted the code - here it worked). Try commenting on this line (and adding a "pass") - if the error is gone, write the line (copy and paste will paste the invisible character together)
– jsbueno
When copying the code to my virtual environment, it worked correctly, it was giving syntax error when trying to run in python 2, but when using python3 specifically it works, make sure you are actually using the python3 version, if running from the terminal, run using: python3 name.py
– Absolver