Can I replace a "enter key" for a " " in Python? Read description
I am trying to translate PDFs using Google traductor but when I tried to paste it on Google traductor I have to errase manually the spaces Auto generated on pdf files (that I call in the question "enter key") . And this makes problems in the translation. Here is an example: Modify this: "Recently, and with increasing frequency, an idea has begun to turn in our minds and to beat in our hearts: the ambition of being the creators of our own thinking. " To this: "Recently, and with increasing frequency, an idea has begun to turn in our minds and to beat in our hearts: the ambition of being the creators of our own thinking" I tried to make this on Python because I'm learning and I am in big problems. Can someone help me? This is my code: file = open("newfile.txt", "w") file.write("""Recently, and with increasing frequency, an idea has begun to turn in our minds and to beat in our hearts: the ambition of being the creators of our own thinking. """) file.close() file = file.replace("/n"," ") file = open("newfile.txt", "r") print(file.read()) file.close() I am a beginner in Python. Sory for the terrible code