我希望将字符串的右侧左对齐。我正在编写IRC机器人的HELP命令,我希望描述在整个宽度上左对齐:
List of commands:
## ! Say a Text
## execute Execute an IRC command
## help Help for commands
ljust 适用于整个字符串,但我只想对字符串的一部分进行操作,应该怎么做呢?以下是我当前生成字符串的代码:
format.color( "## ", format.LIME_GREEN ) + self.commands[ cmd ][1].__doc__.format( format.bold( cmd ) ).splitlines()[0].strip()