Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.066 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'clean.': 0.09; 'subject:string': 0.09; 'def': 0.12; 'mailscanner,': 0.16; 'subject:python': 0.16; 'header:User-Agent:1': 0.23; 'header:In- Reply-To:1': 0.27; 'scanned': 0.29; '>>>>': 0.31; 'thanks!': 0.32; 'subject: (': 0.35; 'subject:with': 0.35; 'believed': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'dangerous': 0.60; 'length': 0.61; 'viruses': 0.61; 'from:charset:utf-8': 0.61 Date: Sat, 20 Sep 2014 14:21:50 +0200 From: =?UTF-8?B?TmFneSBMw6FzemzDsyBac29sdA==?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: pad binary string with a given byte value (python 3) References: <541D5025.4070604@shopzeus.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-shopzeus-MailScanner-Information: Please contact the ISP for more information X-shopzeus-MailScanner-ID: ECEBA8897398.ADCE1 X-shopzeus-MailScanner: Found to be clean X-shopzeus-MailScanner-From: gandalf@shopzeus.com X-Spam-Status: No X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411215717 news.xs4all.nl 2950 [2001:888:2000:d::a6]:52458 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78102 > bytes/str.ljust() > >>>> def pad(b, n=16, c=b"\x0f"): > ... length = (len(b)+n-1)//n*n > ... return b.ljust(length, c) Thanks! -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.