Replies: 5 comments 3 replies
|
You have embedded it in an f string. The 3.10 version of Python, used in current Pythonista, does not allow quote marks of same type in the string. , so f””” is invalid. |
|
That’s fair enough. I have never seen triple quoted strings in an f-string. I’d love a new version too. Would love scipy included! |
|
The problem seems to be only with tripple double quotes information_header = f'''Observed Body: {observed_body}
Observation time {observation_time} UTC
Calculation time {str(datetime.datetime.now(ZoneInfo('UTC')))} UTC
'''I sometimes use Pythons automatic concatenation of strings for multi-line strings, because that gives me more control over the indentation levels, and you can mix f and r and plain strings (but not b strings) : information_header2 = (f'Observed Body: {observed_body}' '\n'
f'Observation time {observation_time} UTC' '\n'
f'Calculation time {str(datetime.datetime.now(ZoneInfo("UTC")))} UTC' '\n'
)The parentheses are necessary tor this to work. |
|
same issue |
|
This is how the syntax highlighting looks on my iPad in Pythonista 3.4: The problem only starts with the line containing Here is the output, showing that the program execution is not affected: |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
information_header = f"""Observed Body: {observed_body}
Observation time {observation_time} UTC
Calculation time {str(datetime.datetime.now(ZoneInfo('UTC')))} UTC
"""
The lines following the above code are highlighted as commented out, but it 'compiles' and runs OK.
All reactions