Hacking The Fender - Incorrect string output to file

Hacking The Fender exercise link

with open("new_passwords.csv", 'w') as new_passwords_obj:
    slash_null_sig = """ _  _     ___   __  ____
/ )( \   / __) /  \(_  _)
) \/ (  ( (_ \(  O ) )(
\____/   \___/ \__/ (__)
 _  _   __    ___  __ _  ____  ____
/ )( \ / _\  / __)(  / )(  __)(    \
) __ (/    \( (__  )  (  ) _)  ) D (
\_)(_/\_/\_/ \___)(__\_)(____)(____/
        ____  __     __   ____  _  _
 ___   / ___)(  )   / _\ / ___)/ )( \
(___)  \___ \/ (_/\/    \\___ \) __ (
       (____/\____/\_/\_/(____/\_)(_/
 __ _  _  _  __    __
(  ( \/ )( \(  )  (  )
/    /) \/ (/ (_/\/ (_/\
\_)__)\____/\____/\____/"""

    new_passwords_obj.write(slash_null_sig)

That is my code. If you look at the screenshot I am pretty certain that the output to the file new_passwords.csv is incorrect. How can I correct this?

1 Like

that is the content of your string
file io is not involved

you can look at where the differences are and what you have in your code at those locations

you can write that text to a file, read it from file into a string, and compare to your string

you can print your string to inspect it

print(repr(mystring))

for the purpose of making observations you might wish to use a smaller string, you can probably manage to cut out a small piece that seems problematic.

1 Like

Forward slashes…thanks :slight_smile:

well…backward
you can use raw string literals to avoid having to escape them, or as mentioned, treat it like data, put it in a file