Re: [Tutor] python time

2009-11-25 Thread Lie Ryan
spir wrote: Hello, How does python get the time in microseconds? time.time() should provide fractional second accuracy if the system provides them. Did the system clock actually record fractional seconds? ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] Is there any way to move the print cursor in IDLE?

2009-11-25 Thread Alan Gauld
"Luhmann" wrote for a in range(int(1e+307)):... a=str(a)... b='\b'*len(a)... print(b,a, sep='',end='') But this only works on the command prompt, in IDLE it will flood the screen. How do I do it? I don't think you can since IDLEs output window does not obey the terminal control codes of th

Re: [Tutor] python time

2009-11-25 Thread Alan Gauld
"spir" wrote How does python get the time in microseconds? The underlying OS API generally provides that. (In other words, how would I get it if python (like some other languages) would provide time in whole seconds only?) You would have to call the OS routines directly from Python you

[Tutor] Is there any way to move the print cursor in IDLE?

2009-11-25 Thread Luhmann
I wanted to display a counter for my loops like this: >>> for a in range(int(1e+307)):... a=str(a)... b='\b'*len(a)... >>> print(b,a, sep='',end='') But this only works on the command prompt, in IDLE it will flood the screen. How do I do it? Découvrez les photos les plus i

Re: [Tutor] UnicodeEncodeError

2009-11-25 Thread Kent Johnson
On Wed, Nov 25, 2009 at 8:44 AM, Albert-Jan Roskam wrote: > Hi, > > I'm parsing an xml file using elementtree, but it seems to get stuck on > certain non-ascii characters (for example: "ê"). I'm using Python 2.4. > Here's the relevant code fragment: > > # CODE: > for element in doc.getiterator():

[Tutor] python time

2009-11-25 Thread spir
Hello, How does python get the time in microseconds? (In other words, how would I get it if python (like some other languages) would provide time in whole seconds only?) Thank you, Denis la vita e estrany http://spir.wikidot.com/

Re: [Tutor] the art of testing

2009-11-25 Thread spir
Serdar Tumgoren wrote: > And the more I hear from you folks, the more I start thinking that my > confusion arose because I don't have a formal set of requirements and > therefore have to wear multiple hats I think a base confusion was between your app's own job (validation), on one hand, and te

Re: [Tutor] Difficulty with csv files - line breaks

2009-11-25 Thread Tim Goddard
> Date: Tue, 24 Nov 2009 15:01:38 -0800 > From: Albert Sweigart > To: tutor@python.org > Subject: Re: [Tutor] Difficulty with csv files - line breaks > Message-ID: >        <716dd5b60911241501y57db5c62r358b1a9859a3a...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Tim, > > I'v

Re: [Tutor] the art of testing

2009-11-25 Thread Serdar Tumgoren
Thanks to everyone for the detailed and varied responses. They really help get me situated in this unfamiliar world of testing. And the more I hear from you folks, the more I start thinking that my confusion arose because I don't have a formal set of requirements and therefore have to wear multipl

Re: [Tutor] UnicodeEncodeError

2009-11-25 Thread spir
Albert-Jan Roskam wrote: > # CODE: > for element in doc.getiterator(): >   try: > m = re.match(search_text, str(element.text)) >   except UnicodeEncodeError: >     raise # I want to get rid of this exception. First, you should separate both actions done in a single statement to isolate the

[Tutor] UnicodeEncodeError

2009-11-25 Thread Albert-Jan Roskam
Hi,   I'm parsing an xml file using elementtree, but it seems to get stuck on certain non-ascii characters (for example: "ê"). I'm using Python 2.4. Here's the relevant code fragment:   # CODE: for element in doc.getiterator():   try: m = re.match(search_text, str(element.text))   except Unic

Re: [Tutor] the art of testing

2009-11-25 Thread Kent Johnson
On Tue, Nov 24, 2009 at 3:41 PM, Serdar Tumgoren wrote: > << requirements snippet>> > > Root node of every XML file is PublicFiling > Every PublicFiling node must contain at least one Filing node > Every Filing must contain 'Type' attribute > Every Filing must contain 'Year' attribute, etc. > Fil

Re: [Tutor] Nested loop of I/O tasks

2009-11-25 Thread Kent Johnson
On Wed, Nov 25, 2009 at 1:38 AM, Christian Witts wrote: > If your output is going to be sorted like that so you know NONAME will be on > the same line in both files what you can do is > > INCT = open('something.csv', 'r') > INMRI = open('something_else.csv', 'r') > > rec_INCT = INCT.readline() >

Re: [Tutor] Nested loop of I/O tasks

2009-11-25 Thread Kent Johnson
On Tue, Nov 24, 2009 at 5:42 PM, Bo Li wrote: > Dear Python > > I am new to Python and having questions about its usage. Currently I have > to read two .csv files INCT and INMRI which are similar to this > ... > > My job is to match the name on the two files and combine the first three > attrib

Re: [Tutor] file questions

2009-11-25 Thread Alan Gauld
"spir" wrote 1) encoding guess How can python do that? I'll let someone else try that one :-) 2) time stamp How to read it (found no attr in "file" type)? (If possible in platform independant manner, and as datetime object.) Which timestamp? There are several. To read them use the os.p

[Tutor] file questions

2009-11-25 Thread spir
Hello, 1) encoding guess >From the library manual: file.encoding The encoding that this file uses. When Unicode strings are written to a file, they will be converted to byte strings using this encoding. In addition, when the file is connected to a terminal, the attribute gives the encoding t

Re: [Tutor] How to get new messages from maildir?

2009-11-25 Thread Alan Plum
Ahoy! On Di, 2009-11-24 at 23:47 +, chombee wrote: > I'm using the standard mailbox module to read a maildir, but it seems to > be quite difficult to do some simple things. Is there any way to > identify a message as new, unread, unseen or something similar? What > about finding the most re