Re: Consistent error

2016-01-03 Thread cc . fezeribe
On Sunday, January 3, 2016 at 5:28:49 PM UTC+1, Ian wrote: > On Sun, Jan 3, 2016 at 8:59 AM, wrote: > > Thanks Chris! > > Don't worry about the indent, will fix it > > I've rewritten it to this- > > > > def get_algorithm_result( numlist ): > >> largest = numlist[0] > >> i = 1 > >> while ( i <

Re: Consistent error

2016-01-03 Thread cc . fezeribe
On Sunday, January 3, 2016 at 5:14:33 PM UTC+1, Chris Angelico wrote: > On Mon, Jan 4, 2016 at 2:59 AM, wrote: > > Thanks Chris! > > Don't worry about the indent, will fix it > > I've rewritten it to this- > > > > def get_algorithm_result( numlist ): > >> largest = numlist[0] > >> i = 1 > >>

Re: Consistent error

2016-01-03 Thread cc . fezeribe
Thanks Chris! Don't worry about the indent, will fix it I've rewritten it to this- def get_algorithm_result( numlist ): > largest = numlist[0] > i = 1 > while ( i < len(numlist) ): i = i + 1 >if ( largest < numlist[i]): > largest = numlist[i] > numlist[i] = numlist[-1]

Consistent error

2016-01-03 Thread cc . fezeribe
Good day, please I'm writing the algorithm below in python but unittest keeps giving error no matter how i rewrite it. This is the algorithm:   Create a function get_algorithm_result to implement the algorithm below Get a list of numbers L1, L2, L3LN as argument Assume L1 is the largest,  La

ACE RSA Authentication Manager

2010-04-11 Thread @ Rocteur CC
Hi, Anyone out there writing Jython for RSA Authentication Manager ? I'm fairly new to Python but I see it is possible to write Jython scripts for user administration. I'm also very interested in writing scripts for monitoring and basically everything else related to RSA but in Jython, i.e

Re: Python dos2unix one liner

2010-02-27 Thread @ Rocteur CC
On 27 Feb 2010, at 12:44, Steven D'Aprano wrote: On Sat, 27 Feb 2010 10:36:41 +0100, @ Rocteur CC wrote: cat file.dos | python -c "import sys,re; [sys.stdout.write(re.compile('\r\n').sub('\n', line)) for line in sys.stdin]" >file.unix Holy cow!

Python dos2unix one liner

2010-02-27 Thread @ Rocteur CC
Hi, This morning I am working though Building Skills in Python and was having problems with string.strip. Then I found the input file I was using was in DOS format and I thought it be best to convert it to UNIX and so I started to type perl -i -pe 's/ and then I though, wait, I'm learning

Re: Help with regex search-and-replace (Perl to Python)

2010-02-07 Thread @ Rocteur CC
On 07 Feb 2010, at 10:03, Shashwat Anand wrote: Here is one simple solution : >>> intext = """Lorem [ipsum] dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut [labore] et [dolore] magna aliqua.""" >>> intext.replace('[', '{').replace(']', '}') 'Lorem {ipsum

Can I add methods to built in types with classes?

2007-08-19 Thread CC
Hi: I've gotten through most of the "9. Classes" section of the tutorial. I can deal with the syntax. I understand the gist of what it does enough that I can play with it. But am still a long way from seeing how I can use this OOP stuff. But I have one idea. Not that the functional approac

Hex editor - Python beginner's code open to review

2007-08-10 Thread CC
Hi: http://web.newsguy.com/crcarl/python/hexl.py This is my first Python program other than tutorial code snippet experimentation. I chose a hex line editor. I may do a hex screen editor once this is done, if I feel like playing with the curses module. Or move straight to wxPython. This i

Re: Hex editor display - can this be more pythonic?

2007-07-29 Thread CC
Dennis Lee Bieber wrote: > On Sun, 29 Jul 2007 12:24:56 -0700, CC <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >>for c in ln: >> if c in printable: sys.stdout.write(c) >> else: >> sys.stdout.write('\x1B[31m.') >

Re: Hex editor display - can this be more pythonic?

2007-07-29 Thread CC
Marc 'BlackJack' Rintsch wrote: > On Sun, 29 Jul 2007 12:24:56 -0700, CC wrote: >>The next step consists of printing out the ASCII printable characters. >>I have devised the following silliness: >> >>printable = ' >>[EMAIL PROTECTED]&8*9(0)

Hex editor display - can this be more pythonic?

2007-07-29 Thread CC
Hi: I'm building a hex line editor as a first real Python programming exercise. Yesterday I posted about how to print the hex bytes of a string. There are two decent options: ln = '\x00\x01\xFF 456\x0889abcde~' import sys for c in ln: sys.stdout.write( '%.2X ' % ord(c) ) or this: sys.st

Re: How to stop print printing spaces?

2007-07-28 Thread CC
Roel Schroeven wrote: > CC schreef: >> ln = '\x00\x01\xFF 456789abcdef' >> # This works: >> import sys >> for i in range(0,15): >> sys.stdout.write( '%.2X' % ord(ln[i]) ) >> print >> Is that the best way, to work directl

How to stop print printing spaces?

2007-07-28 Thread CC
Hi: I've conjured up the idea of building a hex line editor as a first real Python programming exercise. To begin figuring out how to display a line of data as two-digit hex bytes, I created a hunk of data then printed it: ln = '\x00\x01\xFF 456789abcdef' for i in range(0,15): print '%.2X

Re: Should I use Python for these programs?

2007-07-10 Thread CC
Bjoern Schliessmann wrote: > Grant Edwards wrote: > >>Most of the graphics I do with Python is with Gnuplot (not >>really appropriate for what you want to do. >>wxWidgets/Floatcanvas might be worth looking into. > > Agreed (I'm quite sure you mean wxPython though). Also, in "wxPython > in Action"

Re: Should I use Python for these programs?

2007-07-10 Thread CC
Michele Simionato wrote: > On Jul 10, 5:09 am, CC <[EMAIL PROTECTED]> wrote: >>2. Develop a simple vector drawing program that will allow one to >>freehand draw a sketch composed of a few lines, or perhaps render text >>in a vector form. Then sample the lines with a c

Re: Should I use Python for these programs?

2007-07-10 Thread CC
Hendrik van Rooyen wrote: > "CC" <[EMAIL PROTECTED]> wrote:[edit] >>1. Develop a simple GUI program to run on Linux and Windows which can >>send parameters and small blocks of data to an embedded microcontroller >>device via RS-232 or USB. Also display si

Should I use Python for these programs?

2007-07-09 Thread CC
Hi: I have considerable C and assembly language experience. However, these are mostly on embedded microcontrollers since I moved away from PC programming all the way back in 1988 :-O I wish to accomplish a few PC programming tasks, and am considering to learn Python: 1. Develop a simple GUI

How to add columns to python arrays

2006-05-17 Thread CC
Hi there, I wanna compile a 6000x1000 array with python. The array starts from 'empty', each time I get a 6000 length list, I wanna add it to the exist array as a column vector. Is there any function to do so? Or, I can add the list as a rows, if this is easier, and transpose the whole array afte

在消息 "Hi"中发现病毒

2005-10-20 Thread cc
The message contains Unicode characters and has been sent as a binary attachment. -- http://mail.python.org/mailman/listinfo/python-list