RESEARCHUT
Minds With Innovations

RESEARCHUT - minds with innovations

Search!

Archives

Next Archive Previous Archive

01 Jun - 30 Jun 2005
01 Jul - 31 Jul 2005
01 Aug - 31 Aug 2005
01 Sep - 30 Sep 2005
01 Oct - 31 Oct 2005
01 Dec - 31 Dec 2005
01 Jan - 31 Jan 2006
01 Feb - 28 Feb 2006
01 Mar - 31 Mar 2006
01 Apr - 30 Apr 2006
01 May - 31 May 2006
01 Jun - 30 Jun 2006
01 Jul - 31 Jul 2006
01 Aug - 31 Aug 2006
01 Oct - 31 Oct 2006
01 Nov - 30 Nov 2006
01 Dec - 31 Dec 2006
01 Jan - 31 Jan 2007
01 Mar - 31 Mar 2007
01 Apr - 30 Apr 2007
01 May - 31 May 2007
01 Jul - 31 Jul 2007
01 Aug - 31 Aug 2007
01 Oct - 31 Oct 2007
01 Nov - 30 Nov 2007
01 Jan - 31 Jan 2008
01 Feb - 29 Feb 2008
01 Mar - 31 Mar 2008
01 Apr - 30 Apr 2008
01 May - 31 May 2008
01 Jun - 30 Jun 2008
01 Jul - 31 Jul 2008
01 Aug - 31 Aug 2008

Categories

Fun
KDE
Sex
Rant
News
Debian
Romance
Computer
Software
Philosophy
Technology
Programming

About

A space which could be philosophic, energetic, poetic, technic, mantic, idealistic, frenetic and sarcastic at times,
I guess!


Copyright © Ritesh Raj Sarraf

Unless specifically stated otherwise, the information on this page is available under the terms of the
GNU Free Documentation License.

Calendar

« March 2010
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Links

RESEARCHUT
Technical Consultancy
Photo Gallery
About Me

Last Comments

Ashish Shukla (Boston, MA): So, are you also going to …
Ravi (Boston, MA): How did they allow you? BT…
Ritesh (Lambroghini Drink…): Stopped != Quit Blame th…
Ravi (Lambroghini Drink…): Someone said that you stop…
Ritesh Raj Sarraf… (KDE4 with KDE3): Sorry. One more important …

Powered By

Powered by Pivot - 1.40.6: 'Dreadwind'
XML: RSS Feed
XML: Atom Feed
Pivot Blacklist
Powered by Debian

Linkdump

+ 3 - 6 | § iprint - Andrew "Tridge" Tridgell's iprint in Python

Following code does the same thing that Tridge's iprint.c does. :-)
#!/usr/bin/env python
import sys
"iprint - Andrew \"Tridge\" Tridgell's iprint in Python"
def toBinary(dec):
"""
This function does the coversion from integer to binary
"""
    bin = ''
    while dec:
        bin = (dec % 2 and '1' or '0') + bin
        dec = long(dec/2)
    return bin or '0'
 
x = 1
text = ''
while len(sys.argv) > 1 and x < len(sys.argv):
    text += sys.argv[x]
    x += 1
 
for x in text:
    print ord(x), "\t", hex(ord(x)), "\t", oct(ord(x)), "\t", toBinary(ord(x)), "\t", x
    print "\n"
Used tags:

Keywords: iprint,Python,Tridge,Binary,Decimal,Hex,Octal

- Powered by vIm && Mozilla - Best viewed with your eyes