I wrote this line of code: database = {"host":host, "user":user, "password":password, "db":db, "charser":charset, "cursorclass":cursorclass}

and i'm receiving this: {'host': '35.234.92.142', 'user': "b'freedbtech_'", 'password': "b''", 'db': "b'freedbtech_cursopython'", 'charset': 'utf8mb4', 'cursorclass': "<class 'pymysql.cursors.'>}

i need to remove those "b's" and " ' " in the strings, but i don't know how to do that, i was writing line to line to the document with this code:

save_changes_archive.write(host + "\n")
    save_changes_archive.write(user + "\n")
    save_changes_archive.write(password + "\n")
    save_changes_archive.write(db + "\n")
    save_changes_archive.write(charset + "\n")
    save_changes_archive.write(cursorclass + "\n")

but the same happened. How can i remove it without changing the data i need to use?

PS. I would chat about the topic but seeing the password issue yet again raises that question.
Also, the code you shared doesn't really tell me enough to give ideas about how to write what you want to see, plus I don't know what you want at the end of all this.

Parsing strings is pretty basic fare in compsci classes.

Still I can't see where the b's originate. Maybe it's in code that wasn't shared? Can't tell yet.
Many will tell you to use regex. Note: https://www.w3schools.com/python/python_regex.asp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.