Python: Writing text with a width seperator? -


i looks this:

-----hello------ 

now know can symbols print defining , printing width, how insert text within it? thanks.

you should try this:

print 'hello'.center(16,'-') 

or this:

print '{:-^16}'.format("hello") 

that set width 16 , pad string '-'.

check tutorial here.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -