0
encoding = ('utf-8')
data = b"C:\Users\victim\Desktop\test1.exe"
print (data.decode(encoding))

when I run it I get the following C:\Users[]ictim\Desktop est1.exe what I need to get is C:\Users\victim\Desktop\test1.exe

1
  • change to data to \\ instead of \ Commented Sep 19, 2019 at 11:14

1 Answer 1

2

You'll need to escape the \ characters, otherwise it'll pick up on the character next to it and take it as a \t. Try:

>>> encoding = ('utf-8')
>>> data = b"C:\\Users\\victim\\Desktop\\test1.exe"
>>> print (data.decode(encoding))
C:\Users\victim\Desktop\test1.exe

Alternatively, skip the encoding part, and just define your string as raw:

data = r"C:\Users\victim\Desktop\test1.exe"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.