Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'string.': 0.05; 'subject:Python': 0.06; 'result,': 0.07; 'variables': 0.07; 'subject:help': 0.08; 'string': 0.09; 'cc:addr:python-list': 0.11; 'assume': 0.14; 'between.': 0.16; 'concatenate': 0.16; 'integer.': 0.16; 'seconds,': 0.16; 'seconds.': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'variable': 0.18; 'received:10.0.1': 0.19; '(the': 0.22; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'format,': 0.24; 'integer': 0.24; 'string,': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'statement': 0.30; 'url:mailman': 0.30; 'though.': 0.31; 'you\x92re': 0.31; 'this.': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'third': 0.33; 'could': 0.34; 'subject:with': 0.35; 'add': 0.35; 'there': 0.35; 'minutes,': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'subject:?': 0.36; 'received:10.0': 0.36; 'url:org': 0.36; 'seconds': 0.37; 'turn': 0.37; 'two': 0.37; 'received:10': 0.37; 'url:library': 0.38; 'pm,': 0.38; 'sure': 0.39; 'url:mail': 0.40; 'how': 0.40; 'easy': 0.60; "you're": 0.61; 'first': 0.61; 'header :Message-Id:1': 0.63; 'talking': 0.65; 'to:addr:gmail.com': 0.65; 'charset:windows-1252': 0.65; 'minutes': 0.67; '2014,': 0.84; 'about?': 0.84; 'scott': 0.93 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020208.52F45C7D.0078,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=F4SJgNdN c=1 sm=1 a=MB85R812cvcrhCHz/P2OVA==:17 a=EcIEWpwOQlAA:10 a=G8Uczd0VNMoA:10 a=N659UExz7-8A:10 a=kviXuzpPAAAA:8 a=ONB2eeuiHFIA:10 a=pGLkceISAAAA:8 a=8AHkEIZyAAAA:8 a=DkqqS6RjySCHm09Vit4A:9 a=pILNOxqGKmIA:10 a=6mSPqtV_LXQA:10 a=MSl-tDqOz04A:10 a=4vB-4DCPJfMA:10 a=wooeFCzZXMieaemM:21 a=V8cgFHq7ehsx98SX:21 a=MB85R812cvcrhCHz/P2OVA==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=swdunning@cox.net Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: Python 2.7.6 help with white spaces? From: Scott W Dunning In-Reply-To: Date: Thu, 6 Feb 2014 21:09:31 -0700 Content-Transfer-Encoding: quoted-printable References: To: Chris Angelico X-Mailer: Apple Mail (2.1827) Cc: "python-list@python.org" 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: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391746182 news.xs4all.nl 2847 [2001:888:2000:d::a6]:58602 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65587 Is this what you=92re talking about? =20 minutes =3D =933=94 seconds =3D =9311=94 print int(minutes), =94:" int(seconds) That=92s what you mean by turning a string into an int right? Not sure = how to add strings together though. On Feb 6, 2014, at 6:37 PM, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 12:22 PM, Scott W Dunning = wrote: >> Assume variables exist for minutes and seconds. Each variable is an = integer. >> How would you create a string in the format, >>=20 >> 3:11 >>=20 >> with no spaces. where 3 is minutes and 11 is seconds. >>=20 >>=20 >> Obviously when I=85 >>=20 >> print minutes, =93:=94, seconds >>=20 >> I get 3 : 11 >>=20 >> how can I get it to print with no spaces? >>=20 >> 3:11 >=20 > The print statement isn't right for what you're doing here. You need > to create a single string with that result, which you could then print > out. >=20 > There are two easy ways to do this. First one is to create a string > from the number of minutes, create a string from the number of > seconds, and concatenate them, with a third string (the colon) in > between. Do you know how to turn an integer into a string, and do you > know how to add strings together? >=20 > The second way is to format the values directly into a single string. > You can use printf codes for this. Check this out: >=20 > = http://docs.python.org/2/library/stdtypes.html#string-formatting-operation= s >=20 > ChrisA > --=20 > https://mail.python.org/mailman/listinfo/python-list