Python щелкните помощь по форматированию новой строкиPython

Программы на Python
Anonymous
Python щелкните помощь по форматированию новой строки

Сообщение Anonymous »

Я вижу, что в моем ЭПИЛОГЕ не сохраняется перевод строки? Я хочу знать, почему, если я вижу, что новая строка остается только тогда, когда строка содержит 74 символа?

# http://click.pocoo.org/5/commands/

import click, sys

def main_caller(*args, **kwargs):
print('act on arguments', args, kwargs)

EPILOG = '''
# oneline
# twoline

\n
# oneline with 74char x
# twoline with 74char x
'''

@click.group(help='wwwwwwwwww', epilog=EPILOG, invoke_without_command=True, chain=True)
@click.argument('start_or_stop')
@click.option('-v', '--verbose', default=False, help='Print Verbose messages')
@click.option('-l', '--logfile', help='Path to logfile to store log messages')
@click.option('-a', '--action', multiple=True, type=click.Choice(['act1', 'act2', 'act3']), default=['act1', 'act2'])
def cli(*args, **kwargs):
'''foo bar'''
pass

@cli.command()
@click.option('--debug/--no-debug', default=False)
def cmd1(*args, **kwargs):
print('cmd1', args, kwargs)
return 'cmd11111'

@cli.command()
@click.option('-x', '--xxx', default='x')
def cmd2(*args, **kwargs):
print('cmd2', args, kwargs)
return 'cmd22222'

@cli.resultcallback()
def process_pipeline(*args, **kwargs):
print('process', args, kwargs)
print('args', sys.argv[1:])

if __name__ == '__main__':
cli()


Вывод:

/click_sandbox.py --help
2017/02/24 19:31:43 Platform overridden to 'RHEL5_64'
Usage: click_sandbox.py [OPTIONS] START_OR_STOP COMMAND1 [ARGS]... [COMMAND2
[ARGS]...]...

wwwwwwwwww

Options:
-v, --verbose TEXT Print Verbose messages
-l, --logfile TEXT Path to logfile to store log messages
-a, --action [act1|act2|act3]
--help Show this message and exit.

Commands:
cmd1
cmd2

# oneline # twoline

# oneline with 74char x
# twoline with 74char x


Подробнее здесь: https://stackoverflow.com/questions/424 ... ng-newline

Вернуться в «Python»