Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; 'output': 0.05; 'blue': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'green,': 0.16; 'possible?': 0.16; 'red,': 0.16; 'repr': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'trying': 0.19; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'subject:with': 0.35; 'display': 0.35; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'set.': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'received:209': 0.37; 'ends': 0.38; 'how': 0.40; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'colour': 0.84; 'subject:color': 0.84; 'contents.': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EQPN0CEKCdoLECTK2RCwZ3Bp8Y7OXWOgWJc7NFofnk8=; b=zSxdl7eEt6dpuMCgEW+vMI188YaARm4iGFyA1fmbWF32WDqF6oR2vNQQYMftLMIxt/ 9pJJECq/peRxWGjOtVbSadd0HBofAKthv8Wf8J3dfO3VmWkK48pETWZsYWZsk6V2cB71 2Ul07G+psO8NpJ5rPTBZ3XSXx/1DR9qG+DL6gXC5brlopWzFtE3nuxwAzGzwpxvyKHLu nZOaXVKBR8JWYRjs85+W/q0nJ45u6t9+QKsFEm1m9SV4Zsz1E7UA7QP8Us5N0Az3cUCj CSIeKsM4RgFRBDxhMqKXzxyd1P8ZcbShND6KOL9Q3ZRK2fRgi3/6G0oZEhMZEwjc/8cu iQYg== MIME-Version: 1.0 X-Received: by 10.224.163.129 with SMTP id a1mr2782248qay.1.1369829477481; Wed, 29 May 2013 05:11:17 -0700 (PDT) In-Reply-To: <0965b949-8bf4-4105-aa8a-17cfd0d22aa4@googlegroups.com> References: <0965b949-8bf4-4105-aa8a-17cfd0d22aa4@googlegroups.com> Date: Wed, 29 May 2013 13:11:17 +0100 Subject: Re: Output is not coming with defined color From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Avnesh Shakya Content-Type: multipart/alternative; boundary=089e01538c7e689c5f04ddda4743 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: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369829480 news.xs4all.nl 15881 [2001:888:2000:d::a6]:35250 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46369 --089e01538c7e689c5f04ddda4743 Content-Type: text/plain; charset=ISO-8859-1 On 29 May 2013 12:25, "Avnesh Shakya" wrote: > > hi, > I am trying to display my output with different colour on terminal, but it's > coming with that colour code. > Please help me how is it possible? > > my code is - > from fabric.colors import green, red, blue > def colorr(): > a = red('This is red') > b = green('This is green') > c = blue('This is blue') > d = {a, b, c} > print d > colorr() > > output - > set(['\x1b[32mThis is green\x1b[0m', '\x1b[34mThis is blue\x1b[0m', '\x1b[31mThis is red\x1b[0m']) > > Thanks You are printing the {a, b, c} set. That ends up printing the repr of all of its contents. The repr breaks the desired output. Try to just print a, b, c --089e01538c7e689c5f04ddda4743 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 29 May 2013 12:25, "Avnesh Shakya" <avnesh.nitk@gmail.com> wrote:
>
> hi,
> =A0 =A0I am trying to display my output with different colour on termi= nal, but it's
> coming with that colour code.
> Please help me how is it possible?
>
> my code is -
> from fabric.colors import green, red, blue
> def colorr():
> =A0 =A0 a =3D red('This is red')
> =A0 =A0 b =3D green('This is green')
> =A0 =A0 c =3D blue('This is blue')
> =A0 =A0 d =3D {a, b, c}
> =A0 =A0 print d
> colorr()
>
> output -
> set(['\x1b[32mThis is green\x1b[0m', '\x1b[34mThis is blue= \x1b[0m', '\x1b[31mThis is red\x1b[0m'])
>
> Thanks

You are printing the {a, b, c} set. That ends up printing th= e repr of all of its contents. The repr breaks the desired output. Try to j= ust

print a, b, c

--089e01538c7e689c5f04ddda4743--