Nov-21-2019, 08:12 AM
(Nov-20-2019, 05:44 PM)snippsat Wrote: The problem is that you useThank you! I had a feeling that it was something like that (although I don't know exactly what a null or zero byte is, I guess it's an empty byte, though not sure what that means either).\0
escape character that is a zero byte.
Inside f-string ther
want work then nothing get printed after zero byte.
Once again, I find curious the different outputs while using different terminals:
1) If I try to attach the output of the original program, as comments to it, in PyScript, the program prevents me doing it, and accepts only this paste:
##Output: ## ##This is string1 'Agent Cheesecake was a double agent.' with r'I have to type manually
r' **'
and then, if I try to paste the rest of the output (I'm very lazy at typing ), the program prevents me again doing it, and accepts only:after censorship:I have once again to type manually the rest:
** was a double agent.
If I run the program in PyScript (with or without the comments), this is the strange output (I say strange, because it's part of making exercises with regex and substitution, the program working fine (without the comments) even in IDLE):
Output:*** Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32. ***
*** Remote Python engine is active ***
>>>
*** Remote Interpreter Reinitialized ***
This is string1 'Agent Cheesecake was a double agent.' with r'
>>>
2) With Cmder, the program (with or without comments) works fine.3) With IDLE the program (without the comments) works fine, but when I add the output as comments to it, and then try to run it again, the program throws back the message:
Error:Syntax error: source code string cannot contain null bytes.
and that's my main question: Why is that the output added to the program as comments throws back an error message if supposedly python overlooks everything that it's inside the comments preceded by ##?All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs