Re: Writing binary files in windows

2011-02-11 Thread Nick Raptis
On 02/12/2011 05:20 AM, Abhishek Gulyani wrote: When I write binary files in windows: file = open(r'D:\Data.bin','wb') file.write('Random text') file.close() and then open the file it just shows up as normal text. There is nothing binary about it. Why is that? Sorry if this is too much of a

Re: default behavior

2010-07-29 Thread Nick Raptis
On 07/29/2010 09:12 PM, wheres pythonmonks wrote: How do I build an "int1" type that has a default value of 1? You mean something like: >>> x = int() >>> x 0 >>> def myint(value=1): ... return int(value) ... >>> myint() 1 >>> That's ugly on so many levels.. Anyway, basic types (and almost

Re: Nice way to cast a homogeneous tuple

2010-07-28 Thread Nick Raptis
Ep, that missing line should be: On 07/28/2010 04:27 PM, Nick Raptis wrote: On 07/28/2010 04:15 PM, wheres pythonmonks wrote: f( *map(lambda x: int(x), struct.unpack('2s2s2s','123456'))) 102 But this seems too complicated. Well, you don't need the lambda at all i

Re: Nice way to cast a homogeneous tuple

2010-07-28 Thread Nick Raptis
On 07/28/2010 04:15 PM, wheres pythonmonks wrote: f( *map(lambda x: int(x), struct.unpack('2s2s2s','123456'))) 102 But this seems too complicated. Well, you don't need the lambda at all int ===lambda x: int(x) So just write It's like writing: def myint(x): return int(x) Nic

Re: iptcinfo: Can not import: Newbie not really knowing what he is doing

2010-07-12 Thread Nick Raptis
Hi Richard! I have downloaded iptcinfo and placed it in python27\Lib\site-packages \iptcinfo I guessed that was the right place, because that is where PIL ended up, but that had a fancy installer with it. You did place it in the right path, but the "fancy installer" does one more thing, it

Re: Hello

2010-07-09 Thread Nick Raptis
Hello Dani! IDLE is very friendly for new users and has got me a long way when I was starting. You also can't beat that it comes bundled with Python. I'd also like to suggest the Python-Tutor list http://mail.python.org/mailman/listinfo/tutor for your "new-user" questions. Lots of helpful fo

Re: 'reload M' doesn't update 'from M inport *'

2010-07-09 Thread Nick Raptis
I know I have more radical options, such as starting a new IDLE window. That would save me time, but I'd like to take the opportunity to understand what is happening. Surely someone out there knows. Frederic Or you can restart the IDLE shell with CTRL+F6. If you can't restart it, you're