python - Pad outgoing messages -


i can't quite figure out how pad message send. basically.. want pad message max 512 chars defined in rfc.

i understand message being sent user contain user!user@hostname privmsg #chan (or other_user): text text text \r\n.

thanks in advance.

to pad string can use functions ljust, center or rjust, respectively:

print "hello, " + "world".ljust(10) + "!" print "hello, " + "world".center(10) + "!" print "hello, " + "world".rjust(10) + "!" 

output (try it):

hello, world     ! hello,   world   ! hello,      world! 

all 3 functions have optional second argument fillchar lets specify character used fill additional space.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -