Python Forum
macron on top of uppercase letters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
macron on top of uppercase letters
#1
I'm having problems displaying a macron on top of uppercase (or if you prefer, capital or mayuscule) letters (for Roman numerals) in Python 3.7.4

Hi, I’m starting to learn Python, so I would appreciate your explanations like you would explain things to a kid. I’m using Python 3.7.4.

I want to represent the number 4000 in Roman numbers by putting a macron (a long line like ¯ ) on top of the letters IV (as the macron multiplies the value by 1000), so 4000 would be represented by IV (4) with a macron on top, 5000 would be represented by V (5) with a macron on top, etc.

The problem I have is that I cannot make it happen in Python. I’ve looked for and seen many answers related, but when I try them, they don’t work in the simplest command.

For example, in my Python 3.7.4 Shell, I write the following command:

1) >>>
print(u'\u004C'+ u'\u00AF')


with the following output:



which is not what I want. I want the macron on top of the letter, not beside it.

I’ve tried switching the order of the unicode numbers of the letter and the combining character, and even using the join function as in:

2) >>>
print('\u0305'.join('L'))
with the following output:

L

and I guess almost any combination you may think of, but no result.

I find it quite curious, because if I want to put an acute accent or a small macron on top of the letter ‘e’, I have no trouble:

3) >>>
print('fue'+u'\u0301')
with the following output:

fué

4) >>>
print('fue'+u'\u0304')
with the following output:

fuē

But if I try it with the letters ‘M’ or even ‘m’, I cannot:

5) >>>
print('M'+u'\u0304')
with the following output:



6) >>>
print('m'+u'\u0304')
with the following output:



Even the following command:

7) >>>
print('fue'+u'\u0305')
produces the output:

fue̅

Please, is there somebody out there who can help me to write I, V, X, L, C, D and M with a long macron on top of them ('\u00AF' or '\u0305')?

Thanks in advance,

newbieAuggie2019

IMPORTANT EDIT!!!:

While previewing the post, to put a bit of colour to it, I found out that HERE, IN THIS FORUM, OPTIONS 5), 6) and 7) WORK, BUT NOT IN MY PYTHON 3.7.4 Shell. WHY IS THAT??? Huh

Let me try here this, then:

print(u'\u0049'+ u'\u0305' + u'\u0056'+ u'\u0305' + u'\u0058'+ u'\u0305' + u'\u004C'+ u'\u0305' + u'\u0043'+ u'\u0305' + u'\u0044'+ u'\u0305' + u'\u004D'+ u'\u0305')
Output:

I̅V̅X̅L̅C̅D̅M̅ Sad Confused Dodgy Angry

Okey, then. Maybe I should make the question in this way: What do I have to do to make it work in my Python 3.7.4 Shell??? Pray
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
Reply


Messages In This Thread
macron on top of uppercase letters - by newbieAuggie2019 - Aug-20-2019, 11:24 PM
RE: macron on top of uppercase letters - by woooee - Aug-21-2019, 03:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  AttributeError: module 'string' has no attribute 'uppercase' Anldra12 10 10,405 Apr-23-2021, 05:30 PM
Last Post: ibreeden
  Python uppercase conversion conditions Jaypeng 7 3,046 Apr-29-2020, 11:24 AM
Last Post: jefsummers
  'True' if 'string' has at least one uppercase letter ClassicalSoul 1 3,387 Feb-28-2019, 12:08 PM
Last Post: buran
  check if value of passed variable has uppercase characters in it. wfsteadman 3 3,289 Sep-01-2017, 05:52 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020