-1

I tried to run some python code, but it says "[pyflakes] unexpected EOF while parsing"

My code is:

if "debug " in code:
  print(" |" + x + "|" + y + "| ")

Edit: Also do NOT say duplicate I tried the answer of the other question and it didn't work. I use Python 3.8.2

  • which other question? also what is `code` and `x` and `y`? if I just assign empty strings (and `'debug'`) to those variables, it works fine for me – Matiiss Jan 05 '22 at 17:53
  • It looks like you are asking about string formatting. Is that not the case? Why is this *not* a duplicate of https://stackoverflow.com/questions/517355/string-formatting-in-python – JonSG Jan 05 '22 at 17:54
  • 1
    Please post more code than this, you're probably just missing a bracket or indent somewhere. – yuuuu Jan 05 '22 at 17:54
  • 2
    The error seems to be NOT RELATED at all with that code and purpose of string formatting. Please share hpw you run the program and the full stacktrace – azro Jan 05 '22 at 17:55
  • 1
    There is no error in your code – Paul Kocian Jan 05 '22 at 17:55
  • Does this answer your question? [String formatting in Python](https://stackoverflow.com/questions/517355/string-formatting-in-python) – Paul Kocian Jan 05 '22 at 17:56
  • 1
    Hi and welcome to SO. Unfortunately, the code you have posted appears to be fine and it looks likely that the error you see is due to something else. Is there more to go on? Perhaps a line number where the error is encountered or is there more to the program that we might be able to see? – JonSG Jan 05 '22 at 17:59

1 Answers1

2

Try using an f-string.

if "debug " in code:
  print(f" | {x} | {y} | ")