-3

I'm currently working on a program that check whether a given string is palindrome or not.

As I input this long string (it's a huge palindrome made in the 80's), Python shell keeps splitting the string, running another input in which he keeps working on the text.

How can I have all the text in one single input entry?

  • Can you read it from a file? – khelwood Jun 03 '19 at 15:08
  • I was trying to copy/paste it, i don't know how to do what you are suggesting (really a newbie in Python here) – Federico Pierucci Jun 03 '19 at 15:17
  • 1
    You could install a library that will read the contents of your clipboard, such as pyperclip. Or you could put this long string in a file and write some code to read it from the file. Or you could post whatever code you have that is not working and someone might be able to suggest an improvement. – khelwood Jun 03 '19 at 15:19

1 Answers1

0

I think the problem you are facing is due to the newline (\n) commands hidden in the text you copy-pasted. The shell interprets those as you press the ENTER button. So you should try to remove those \n's from your text. Therefore you can either use python tools (for more about that click here), but since you directly want to paste the text into the shell I would suggest using websites such as this one. Otherwise reading out the text from a file, as khelwood suggested, should do the job as well.

byTreneib
  • 176
  • 13