About \033[m
Terry Reedy
tjreedy at udel.edu
Sun Apr 4 22:11:50 EDT 2021
On 4/4/2021 7:40 AM, Skip Montanaro wrote:
>> Porque quando se usa formatac,ao de cores, o python nao consegue
>>
> centralizar dentro da cadeia de 40 caracteres ?
>>
>> Tive que colocar 54 no parametro pois de alguma forma esta sendo
>> considerado os caracteres de dentro do comando \033[m
>
>
> Python doesn't know there is anything special about escape sequences (that
> they take up no space on the screen). I think you will have better results
> if you place the escape sequences in the format specifier:
>
> print("\033[7;30;43m{:^40}\033[m".format("Programac,ao Python"))
or
print(f"\033[7;30;43m{"Programac,ao Python":^40}\033[m")
--
Terry Jan Reedy
More information about the Python-list
mailing list