I need to write few basic scripts for students in Python, like this one:
#!/usr/bin/python
# -*- coding: utf-8 -*-
mia_età = 31
print mia_età
But apparently I cannot use accented characters while declaring variables. Is there any way out?
("mia_età" means "my_age" in Italian and I would like to avoid them to write grammar errors in their firts language while learning Python)
Python 1 and 2 only support ASCII alphanumeric characters and _
in identifiers.
Python 3 supports all Unicode letters and certain marks in identifiers.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
mia_età = 31
print(mia_età)
Identifiers are normalized according to NFKC, so you can indifferently write U+0061 LATIN SMALL LETTER A followed by U+0301 COMBINING ACUTE ACCENT, or U+00E1 LATIN SMALL LETTER A WITH ACUTE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With