I'm playing around with pokebase a python wrapper for pokeAPI and some of the api responses contain \n
\x0c
etc. In the end I dont need them but I don't want to just loop through every letter to remove them and .replace doesnt seem sustainable either (also cuz I think that would lead to problems).
This is a sample list of strings: https://pastebin.com/SbhR50br
["The female's horn\ndevelops slowly.\nPrefers physical\x0cattacks such as\nclawing and\nbiting.", 'When resting deep\nin its burrow, its\nthorns always\x0cretract.\nThis is proof that\nit is relaxed.', 'When feeding its\nyoung, it first\nchews and tender\xad\x0cizes the food,\nthen spits it out\nfor the offspring.', 'It has a calm and\ncaring nature.\nBecause its horn\x0cgrows slowly, it\nprefers not to\nfight.', 'It has a docile\nnature. If it is\nthreatened with\x0cattack, it raises\nthe barbs that are\nall over its body.', 'When NIDORINA are with their friends or\nfamily, they keep their barbs tucked\naway to prevent hurting each other.\x0cThis POKéMON appears to become\nnervous if separated from the others.', 'When it is with its friends or\nfamily, its barbs are tucked away to\nprevent injury. It appears to become\nnervous if separated from the others.', 'The female has a gentle temperament.\nIt emits ultrasonic cries that have the\npower to befuddle foes.', 'The female’s horns develop slowly.\nPrefers physical attacks such as clawing\nand biting.', 'When it senses danger, it raises\nall the barbs on its body. These\nbarbs grow slower than NIDORINO’s.', 'When feeding its young, it first\nchews the food into a paste, then\nspits it out for the offspring.', 'It has a calm and caring nature.\nBecause its horn grows slowly, it\nprefers not to fight.', 'When it senses danger, it raises\nall the barbs on its body. These\nbarbs grow slower than Nidorino’s.', 'The female has a gentle temperament.\nIt emits ultrasonic cries that have the power\nto befuddle foes.', 'When feeding its young, it first chews the food into\na paste, then spits it out for the offspring.', 'When Nidorina are with their friends or family, they keep their\nbarbs tucked away to prevent hurting each other.\nThis Pokémon appears to become nervous if separated from\nthe others.', 'When Nidorina are with their friends or family, they keep\ntheir barbs tucked away to prevent hurting each other.\nThis Pokémon appears to become nervous if separated\nfrom the others.']
flavor = random.choice([listofstringshere])
#remove \ stuff from flavor here!
print(flavor)
I think I might be able to do something with regex
but thats just speculation.