Remove Special Characters \n \ t from strings in Python

in #code8 years ago

I had a problem with several ESPN tables that gave me the names of computers with special characters, for example:

u'\n\t\t\t\t\t\t\t\t\t\t\t\t\tRB Leipzig\n\t\t\t\t\t\t\t\t\t\t\t\t' 

What made PrettyTable make the jumps in the table and be unconfigured,  in the book Python for computer science, which is the one we used in  all the specialization we saw some examples of how to format these types  of characters but did not remember: S

But they really leave a lot to think about, and I thought there should  be a more Pythonic way: D, so searching the Web I found this entry that  I read sideways and I remembered the saving method: D, well it looks in  my code:

Computer_nom = computer_nom.strip ()

And here's an example of what I'm talking about:

>>>>>> cadena = u'\n\t\t\t\t\t\t\t\t\t\t\t\t\tRB Leipzig\n\t\t\t\t\t\t\t\t\t\t\t\t'
>>> cadena.strip()
u'RB Leipzig'

Well that was all in a while I upload the final Code of the Standings for multi league in Python with ESPN

God bless you, see you later

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63131.59
ETH 2586.04
USDT 1.00
SBD 2.78