Re: Delete all not allowed characters..

2007-10-25 Thread Michal Bozon
On Thu, 25 Oct 2007 07:52:36 -0700, Abandoned wrote: Hi.. I want to delete all now allowed characters in my text. I use this function: def clear(s1=): if s1: allowed = [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Ş', u'ş', u'Ö', u'ö', u'Ü', u'ü', u'Ç',

Re: Delete all not allowed characters..

2007-10-25 Thread Michal Bozon
the list comprehension does not allow else, but it can be used in a similar form: ( I was wrong, as Tim Chase have shown ) s2 = for ch in s1: s2 += ch if ch in allowed else (maybe this could be written more nicely) Repeatedly adding strings together in this way is about the

[0..9] list (range) syntax

2007-10-24 Thread Michal Bozon
many Python newcomers are confused why range(10), does not include 10. If there was a proposal for the new syntax for ranges, which is known e.g. from Pascal or Ruby... [0..10] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ...is there a chance to be approved ? We have had a short discussion on it at the

Re: [0..9] list (range) syntax

2007-10-24 Thread Michal Bozon
On Thu, 25 Oct 2007 01:16:57 +0200, Wildemar Wildenburger wrote: Michal Bozon wrote: many Python newcomers are confused why range(10), does not include 10. It produces a list of ten elements. Also the documentation is quite clear on the topic. And lastly: This will probably really bother

Re: struct.unpack less than 1 byte

2007-10-10 Thread Michal Bozon
You are able to read single bits from file in C ? You'll have to read the bytes and than perform some bitwise operations on them to extract the bits hello all, i need to read from a file a struct like this [1byte, 12bits, 12bits] reading 1 byte or more is not a problem ... but the 12 bits

Re: Putting a line from a text file into a variable, then moving to next line

2007-10-07 Thread Michal Bozon
On Sun, 07 Oct 2007 12:00:44 +, Vernon Wenberg III wrote: I'm not really sure how readline() works. Is there a way to iterate through a file with multiple lines and then putting each line in a variable in a loop? There are always more ways how to do it.. one of them is: f =

Re: Pil image module, mode bug..

2007-10-07 Thread Michal Bozon
On Sun, 07 Oct 2007 06:03:06 -0700, Abandoned wrote: Hi.. I find the picture color with: im=Image.open(/%s %name) color=im.mode #p=black beyaz rgb=color L=grey This usually work true but in these pictures: http://malatya.meb.gov.tr/images/alt/ilsis_logo.gif

Re: Pil image module, mode bug..

2007-10-07 Thread Michal Bozon
On Sun, 07 Oct 2007 09:02:09 -0700, Abandoned wrote: On Oct 7, 4:47 pm, Michal Bozon [EMAIL PROTECTED] wrote: On Sun, 07 Oct 2007 06:03:06 -0700, Abandoned wrote: Hi.. I find the picture color with: im=Image.open(/%s %name) color=im.mode #p=black beyaz rgb=color L=grey

Re: tkinter question

2007-10-05 Thread Michal Bozon
On Thu, 04 Oct 2007 20:16:14 -0700, goldtech wrote: This works OK. But I notice that if I enlarge the window after the script has run, the white listbox only gets so big while the grey background enlarges. Is there a way to have it all white when I enlarge a window - like what normally

Tkinter / Tk 8.5

2007-09-26 Thread Michal Bozon
Today has been released a first beta of Tk 8.5, including a Ttk (tile) style engine, which makes possible the native look of widgets on MS platform, without having to install any extension. http://wiki.tcl.tk/11075

Re: ~ bit-wise unary operator

2007-09-26 Thread Michal Bozon
cau, maybe int is represented internally as a signed integer you can use numpy types: import numpy ~ numpy.uint16(7978) 57557 -m. On Thu, 27 Sep 2007 00:14:49 +0200, Ladislav Andel wrote: Hello, why ~ bit-wise unary operator returns -(x+1) and not bit inversion of the given integer?