I have a string of the below form:
"\nMy objective is to work with a progressive & innovative
organisation where I can implement my skills, knowledge and \nachieve
success.\n\nPHP\nSDE 2 \nQuikr\nZend\n(CommonFloor merged with
Quikr)\nTasks\nTo develop Quikr Jobs portal\nLaravel\nTo develop
intent-form to increase o\xef\xac\x84ine signups\nTo develop sales CRM
tool\nJava\n \nSDE 1 J2EE\nCommonFloor\nTasks\nJava Spring\nTo work on
hybrid mobile app for residential communities\nTo develop APIs for
CommonFloor Groups\nJavaScript\n\nSDE 1 \njQuery\nIDrive India Pv
Ltd.\nTasks\nAngular JS\nTo develop APIs for cloud storage\nTo add front-end functionalities for online backup and data sync\nGulp\n\nSDE 1 "
I want to replace '\n'
with space
using python. I tried this command:
doc=doc.replace('\n',' ')
but it's not replacing '\n' with space. How I can do this?
Your string seems to be multiline so you need triple quotes '''
. This code works:
doc = '''\nMy objective is to work with a progressive & innovative
organisation where I can implement my skills, knowledge and \nachieve
success.\n\nPHP\nSDE 2 \nQuikr\nZend\n(CommonFloor merged with
Quikr)\nTasks\nTo develop Quikr Jobs portal\nLaravel\nTo develop
intent-form to increase o\xef\xac\x84ine signups\nTo develop sales CRM
tool\nJava\n \nSDE 1 J2EE\nCommonFloor\nTasks\nJava Spring\nTo work on
hybrid mobile app for residential communities\nTo develop APIs for
CommonFloor Groups\nJavaScript\n\nSDE 1 \njQuery\nIDrive India Pv
Ltd.\nTasks\nAngular JS\nTo develop APIs for cloud storage\nTo add front-end functionalities for online backup and data sync\nGulp\n\nSDE 1'''
doc = doc.replace('\n', ' ')
doc=''' your text '''
doc=doc.replace('\n',' ')
print doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With