Issue 33551: The string prefixes u and f can't used together (original) (raw)
Issue33551
Created on 2018-05-17 06:25 by Aifu LIU, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg316883 - (view) | Author: Aifu LIU (Aifu LIU) | Date: 2018-05-17 06:25 |
The string prefixes u and f can't used together, for example: >>> age = 30 >>> s = uf'年龄:{age}' File "", line 1 s = uf'年龄:{age}' ^ SyntaxError: invalid syntax >>> | ||
msg316884 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2018-05-17 06:38 |
Why would you want to do that? | ||
msg316890 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-05-17 07:10 |
The string prefix u is used exclusively for compatibility with Python 2. It helps writing code that works in Python 2 and Python 3. The string prefix f is not compatible with Python 2. If you use it, you no longer have reasons for using the string prefix u. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:00 | admin | set | github: 77732 |
2018-05-17 07:10:00 | serhiy.storchaka | set | status: open -> closednosy: + serhiy.storchakamessages: + resolution: not a bugstage: resolved |
2018-05-17 06:38:52 | benjamin.peterson | set | nosy: + benjamin.petersonmessages: + |
2018-05-17 06:25:08 | Aifu LIU | create |