> 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")) ( haven't tried this, but I think it will work as you expect.) Skip -- https://mail.python.org/mailman/listinfo/python-list