Why date do not construct from date?

2009-06-01 Thread Alexandr N Zamaraev
Simple example: [code] Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 import datetime as dt dt.date(2009, 10, 15) datetime.date(2009, 10, 15) d = dt.date(2009, 10, 15) dt.date(d) Traceback (most recent call last): File stdin, line 1, in module

Re: Interbase

2008-07-30 Thread Alexandr N Zamaraev
Mike Hjorleifsson wrote: Has anyone gotten python working with Interbase database platform ? I See KInterbasDB: http://kinterbasdb.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexandr N Zamaraev
Alexnb wrote: s = '--a href=/browse/brick--brick--/a--' s '--a href=/browse/brick--brick--/a--' ''.join('%s' % l if i % 2 == 1 else l for i, l in enumerate(s.split('--'))) ' /browse/brick brick ' I'm sorry, I don't think I was being clear. I replaced the 's with -- so it would post online

Re: common elements between list of lists and lists

2008-07-17 Thread Alexandr N Zamaraev
list4 = [['1', 'a'],['4', 'd'],['8', 'g']] list5 = [1, 2, 3] set5 = set(list5) [x for n, x in list4 if int(n) in set5] ['a'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Simplify Code

2008-07-16 Thread Alexandr N Zamaraev
header_sizes = (36, 26, 22, 18, 14, 12) if x not in header_sizes: raise Exception() else: h36, h26, h22, h18, h14, h12 = tuple( line if x == size else '' for x in header_sizes) -- http://mail.python.org/mailman/listinfo/python-list

Re: ?

2008-05-15 Thread Alexandr N Zamaraev
urikaluzhny wrote: | It seems that I rather frequently need a list or iterator of the form | [x for x in while ] I can think of two ways to interpret that. I mean like [x for x in A if B], only that it breaks the loop when the expression B is false. How do you plan to modify B during

Re: strftime() argument 1 must be str, not unicode

2008-05-08 Thread Alexandr N Zamaraev
Tim Roberts wrote: I think that's a perfectly reasonable thing to expect. At the risk of over-generalization, there is no good reason why, by this point in time, all of the standard library routines that accept strings shouldn't also accept Unicode strings. However, file(fname), open(fname),

strftime() argument 1 must be str, not unicode

2008-05-07 Thread Alexandr N Zamaraev
Subj is bag? Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. from datetime import datetime datetime.today().strftime('%Y_%m_%d %H_%M_%S.csv') '2008_05_07 12_30_22.csv'

py2exe do not compile from mingw

2008-04-28 Thread Alexandr N Zamaraev
OS: WinXP Home Ru + sp2 Python: 2.5.2 py2exe: latest CSV source gcc (GCC) 3.4.5 (mingw-vista special r2) GNU ld (GNU Binutils) 2.18.50.20080109 OS: WinXP Home Ru + sp2 Python: 2.5.2 py2exe: latest CSV source gcc (GCC) 3.4.5 (mingw-vista special r2) GNU ld (GNU Binutils) 2.18.50.20080109 I have

Help to translate simple VBA code to Python

2008-02-10 Thread Alexandr N Zamaraev
I use Bentley MicroStation through Automation interface. But I do not known how translate some VBA code to Python. For example (Copy Element Example from documentation): code 'The following code starts the command Sub RunCopyElement() CommandState.StartLocate New clsCopyElementCommand End