I am writing a program that gets some data from an API, the response is simple text (no JSON or XML), since the data is in plain text, it also contains escape sequences like \n
and \r
Here's the data as printed by postman.
When I try to split the lines using .split(":")
, the escape sequences get in the way.
Here's the code:
def getSuffix(password):
api_resp = get(f"https://api.pwnedpasswords.com/range/{prefix}")
api_resp = api_resp.text
print(api_resp.split(":"))
I've tried using .strip("\r\n")
as well, but it does not seem to work.
I want the string and the number associated be in a list and this list to be a part of another list.