Re: Parsing a file with iterators

2008-10-17 Thread Eddie Corns
Luis Zarrabeitia <[EMAIL PROTECTED]> writes: >I need to parse a file, text file. The format is something like that: >TYPE1 metadata >data line 1 >data line 2 >... >data line N >TYPE2 metadata >data line 1 >... >TYPE3 metadata >... >And so on. The type and metadata determine how to parse the fol

Re: Regarding Telnet library in python

2008-08-13 Thread Eddie Corns
Hishaam <[EMAIL PROTECTED]> writes: >Hi, >In python documentation, i found a telnet example as follows: >- >import getpass >import sys >import telnetlib >HOST = "localhost" >user = raw_input("Enter your remote account: ") >

Re: trying to match a string

2008-07-18 Thread Eddie Corns
[EMAIL PROTECTED] writes: >Hi, >Hi, >I am taking a string as an input from the user and it should only >contain the chars:L , M or R >I tried the folllowing in kodos but they are still not perfect: >[^A-K,^N-Q,^S-Z,^0-9] >[L][M][R] >[LRM]?L?[LRM]? etc but they do not exactly meet what I need.

Re: parse dates

2008-06-02 Thread Eddie Corns
brechmos <[EMAIL PROTECTED]> writes: >Hi, >I have been using PHP the last while and in particular strtotime. >What I want to replicate is finding the second or fourth Monday of the >next month. In PHP with strtotime it is easy (strtotime("second >Monday", strtotime("next month"), but I can't fin

Re: Thousand Seperator

2008-03-14 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm trying to find some code that will turn: >100 -> 100 >1000 -> 1,000 >100 -> 1,000,000 >-1000 -> -1,000 >I know that can be done using a regular expression. In Perl I would do >something like: >sub thousand { >$number = reverse $_[0]; >$number =

Re: Intelligent Date & Time parsing

2008-03-10 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm new to python and I was wondering if there are any intelligent >date/time parsing modules out there. I've looked at strptime (or >whichever it is) and mxDateTime from the eGenix package. I need >something to parse user input for a django app, and it's awesome to be >

Re: Online Debugging

2008-01-31 Thread Eddie Corns
Yansky <[EMAIL PROTECTED]> writes: >I'm trying to debug a script on my server and it's taking forever >using print to find the error. I've tried to use the debugging >examples on this page http://webpython.codepoint.net/debugging but >they don't seem to be working for me. >Is there an easier/bett

Re: Natural-language datetime parsing and display (was: user friendly datetime features)

2008-01-09 Thread Eddie Corns
For PARSING see http://code-bear.com/code/parsedatetime/ The OP was looking for presentation though. I know roundup has code for this if an independent library can't be found. Eddie -- http://mail.python.org/mailman/listinfo/python-list

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Eddie Corns
chewie54 <[EMAIL PROTECTED]> writes: >Hello, >As an electronics engineer I use some very expensive EDA CAD tool >programs that are scriptable using Tcl. I was wondering why these >companies have choose to use Tcl instead of Python. Some of these >are: > Mentor Graphics ModelTech VHDL and Ve

Re: Can a low-level programmer learn OOP?

2007-07-24 Thread Eddie Corns
Paul McGuire <[EMAIL PROTECTED]> writes: >On Jul 23, 12:43 pm, [EMAIL PROTECTED] (Eddie Corns) wrote: >> Paul McGuire <[EMAIL PROTECTED]> writes: >> >On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote: >> >> Wolfgang Strobl <[EMAIL PROTECTED]&g

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Eddie Corns
Paul McGuire <[EMAIL PROTECTED]> writes: >On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote: >> Wolfgang Strobl <[EMAIL PROTECTED]> writes: >> >few of James Gimple's snippets from "Algorithms in SNOBOL4" >> >(->http://www.snobol4.

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Eddie Corns
Wolfgang Strobl <[EMAIL PROTECTED]> writes: >few of James Gimple's snippets from "Algorithms in SNOBOL4" >(->http://www.snobol4.org/) as an exercise using that library might help >to get a better appreciation. Perhaps I'll try, eventually ... I never noticed them or the PDF of the book there befor

Re: Can a low-level programmer learn OOP?

2007-07-17 Thread Eddie Corns
[EMAIL PROTECTED] (Aahz) writes: >In article <[EMAIL PROTECTED]>, >Wolfgang Strobl <[EMAIL PROTECTED]> wrote: >> >>SNOBOLs powerfull patterns still shine, compared to Pythons clumsy >>regular expressions. >Keep in mind that Python regular expressions are modeled on the >grep/sed/awk/Perl model

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-08 Thread Eddie Corns
vdicarlo <[EMAIL PROTECTED]> writes: >I am a programming amateur and a Python newbie who needs to convert >about 100,000,000 strings of the form "1999-12-30" into ordinal dates >for sorting, comparison, and calculations. Though my script does a ton >of heavy calculational lifting (for which numpy

Re: Calculating CIDR blocks

2007-04-20 Thread Eddie Corns
=?iso-8859-1?q?Pekka_J=E4rvinen?= <[EMAIL PROTECTED]> writes: >On 20 huhti, 14:34, [EMAIL PROTECTED] (Eddie Corns) wrote: >> Look at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466298 >> it handles most of the logic of combining IP ranges. >> >> Eddi

Re: Calculating CIDR blocks

2007-04-20 Thread Eddie Corns
Look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466298 it handles most of the logic of combining IP ranges. Eddie -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help to learn Python

2007-03-26 Thread Eddie Corns
"wesley chun" <[EMAIL PROTECTED]> writes: >with that said, i would still like to state that the book's target >audience is for people who know how to program but need to pick up >Python as quickly as possible. the "theory" that's in the book is >really more explanation of how the Python interpret

Re: flattening/rolling up/aggregating a large sorted text file

2007-03-22 Thread Eddie Corns
[EMAIL PROTECTED] writes: >Hi, >Given a large ascii file (delimited or fixed width) with one ID field >and dimensions/measures fields, sorted by dimensions, I'd like to >"flatten" or "rollup" the file by creating new columns: one for each >combination of dimension level, and summing up measures o

Re: CherryPy/Turbogears on server not controlled by me

2007-02-20 Thread Eddie Corns
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >Brian Blais wrote: >> Hello, >> >> I was wondering if there is a way to run CherryPy/Turbogears on a server >> that I don't >> have root access to. If I just choose a random port, I think the security >> guys on >> the server would get annoyed at

Re: BaseHTTPServer weirdness

2006-09-12 Thread Eddie Corns
Ron Garret <[EMAIL PROTECTED]> writes: >In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: >> I wouldn't necessarily say you are wrong here, It's just that the cgi >> module has sort of "just growed", so it isn't conveniently factyored for >> reusability in other contexts

Re: String pattern matching

2006-04-03 Thread Eddie Corns
Kent Johnson <[EMAIL PROTECTED]> writes: >Eddie Corns wrote: >> If I get time I'll try to get this working in Sam Wilmott's Python pattern >> matching library. >> >> What fun! >Cool! I have to get in on the fun :-) >This program uses Sa

Re: String pattern matching

2006-04-03 Thread Eddie Corns
"Jim Lewis" <[EMAIL PROTECTED]> writes: >Anyone have experience with string pattern matching? >I need a fast way to match variables to strings. Example: >string - variables > >abcaaab - xyz >abca - xy >eeabcac - vxw >x matches abc >y matches a >z matches aab >w maches ac >v maches ee

Re: telnet session

2006-03-29 Thread Eddie Corns
[EMAIL PROTECTED] writes: >hi >i am using a telnet session to simulate an authentication mechanism >USER = "user" >PASSWORD = "password" >try: >telnet = telnetlib.Telnet(HOST) >telnet.set_debuglevel(5) >telnet.read_until("login: ") >telnet.write(USER + "\n") >

Re: Help: Creating condensed expressions

2006-03-24 Thread Eddie Corns
David Hirschfield <[EMAIL PROTECTED]> writes: >Here's the problem: Given a list of item names like: >apple1 >apple2 >apple3_SD >formA >formB >formC >kla_MM >kla_MB >kca_MM >which is a subset of a much larger list of items, >is there an efficient algorithm to create condensed forms that match >t

Re: A better RE?

2006-03-10 Thread Eddie Corns
"Jim" <[EMAIL PROTECTED]> writes: >Eddie Corns wrote: >> Just a small point - what does "in order" mean here? if it means that eg 1362 >> is not valid then you're stuck because it's context sensitive and hence not >> regular. >I

Re: A better RE?

2006-03-10 Thread Eddie Corns
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: >Eddie Corns wrote: >> >I want an re that matches strings like "21MAR06 31APR06 1236", >> >where the last part is day numbers (1-7), i.e it can contain >> >the numbers 1-7, in order, only one

Re: A better RE?

2006-03-10 Thread Eddie Corns
Magnus Lycka <[EMAIL PROTECTED]> writes: >I want an re that matches strings like "21MAR06 31APR06 1236", >where the last part is day numbers (1-7), i.e it can contain >the numbers 1-7, in order, only one of each, and at least one >digit. I want it as three groups. I was thinking of Just a small p

Re: telnetlib problems

2006-03-02 Thread Eddie Corns
[EMAIL PROTECTED] writes: >Thanks for the reply. I've replaced the call to read_very_eager() with >read_until() and enabled debugging messages. My script now looks like >this... ># >import telnetlib >tn = telnetlib.Telnet('192.168.100.11') >tn.set_debuglevel(9) >tn

Re: telnetlib problems

2006-03-01 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm trying to use a python script to access an embedded computer >running linux and connected via a crossover ethernet cable using the >following script... >...and I realize the username and password is not realistic... I'm >still in "proof of concept" stage here :) >#

Re: Twisted book opinions?

2006-02-09 Thread Eddie Corns
Jay Parlar <[EMAIL PROTECTED]> writes: >I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. Well I certainly felt that I understood it better after reading the book. OTOH I haven't tried to put that knowledge into practice yet. I think calling it a cookbook is misleading, it

Re: Python and curses

2005-12-16 Thread Eddie Corns
"linuxfreak" <[EMAIL PROTECTED]> writes: >Was wanting to write a text based application in python seems >curses module is the way to go... anyone knows of any good tutorials >apart from the one written by esr There is at least 1 higher level library atop curses. http://excess.org/urwid/ I've

Re: another time challenge

2005-09-29 Thread Eddie Corns
[EMAIL PROTECTED] writes: >Hey there pythoneers >i have another question about time, specifically, the mxDateTime >module. >i have been able to get a RelativeDateTimeDiff between two times, >it gives me a difference between two DateTimes in the form of +3days >+2hours etc... >so, if i have a dat

Re: Looking for system/network monitoring tool written in Python

2005-09-22 Thread Eddie Corns
Simon Brunning <[EMAIL PROTECTED]> writes: >On 9/22/05, Mike Meyer <[EMAIL PROTECTED]> wrote: >> I've found a fair number of systems/network monitoring tools (things >> like Big Brother, Big Sister, cricket, etc.) written in Perl. I'm >> curious if there are any written in Python. >There's EDDIE

Re: Looking for system/network monitoring tool written in Python

2005-09-22 Thread Eddie Corns
Mike Meyer <[EMAIL PROTECTED]> writes: >I've found a fair number of systems/network monitoring tools (things >like Big Brother, Big Sister, cricket, etc.) written in Perl. Depressing isn't it! >I'm curious if there are any written in Python. I couldn't find any after extensive searching. I was

Re: "week-year" conversion to date

2005-09-14 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I was wondering if it there is an "easy" way to get the dd-mm- from >ww-. >I would like to get, for example the first day (date-month-year) in the >week i specify. Found plenty of ways to go th other way, but none that >give me the reverse. >Idealy I would like

Re: need a little help with time

2005-08-26 Thread Eddie Corns
[EMAIL PROTECTED] writes: >Hey there. >i have a time string (created with strftime) then read from a file, >i am having some trouble understanding how to get the difference >between times. >i know i can structime(timestring) and get a time value, but i dont >know how to manipulate it. >basically,

Re: How to know if connection is active when using telnetlib?

2005-08-26 Thread Eddie Corns
Wojciech Halicki-Piszko <[EMAIL PROTECTED]> writes: >How to know if connection is active after telnetlib.Telnet.open(host,port)? If open() doesn't throw an exception then you should have a connection you can start reading/writing with. Unless you have some special meaning for 'active'? I'm just

Re: ideas for university project ??

2005-08-26 Thread Eddie Corns
Jon Hewer <[EMAIL PROTECTED]> writes: >Hi >I'm about to start my third, and final, year in computer science at >cambridge uni, and i need to come up with an idea for a software >project, but i'm really struggling for ideas, and i was wondering >whether anyone here had any suggestions. >I'd say i

Re: shuffle the lines of a large file

2005-03-07 Thread Eddie Corns
"Joerg Schuster" <[EMAIL PROTECTED]> writes: >Hello, >I am looking for a method to "shuffle" the lines of a large file. >I have a corpus of sorted and "uniqed" English sentences that has been >produced with (1): >(1) sort corpus | uniq > corpus.uniq >corpus.uniq is 80G large. The fact that eve

Re: Trouble using telentlib

2005-02-28 Thread Eddie Corns
[EMAIL PROTECTED] (Nitin Chaumal) writes: >I sarched the existing threads but didnt find an answer to this. >I am writing simple script which uses telentlib to open a session with >a unix machine and run "tail -f logfile.txt" on one of the logfiles. >import telnetlib >HOST = "192.X.X.X" >user =

Re: Trees

2005-02-28 Thread Eddie Corns
Alex Le Dain <[EMAIL PROTECTED]> writes: >Is there a generic "tree" module that can enable me to sort and use >trees (and nodes). Basically having methods such as .AddNode(), >.GetAllChildren(), .FindNode() etc. http://newcenturycomputers.net/projects/rbtree.html might do most of what you want

Re: Tar module issue

2005-02-07 Thread Eddie Corns
I don't have the original query any more but I think your problem is related to mixing absolute and relative file paths. That is the filenames themselves, I think I recall in your original message you were mixing up the idea of global variables in your code versus the filenames stored in the TAR a

Re: HTML Tree View with and

2005-01-28 Thread Eddie Corns
Gregor Horvath <[EMAIL PROTECTED]> writes: >Hi, >Before I reinvent the wheel I`d like to ask if someone has done this >before since I did not find an advice at Google. >The goal is to create a dynamic Tree View in HTML. >Say I have a data strucure like this: >structList = >{'Sun':{'Sun.1':['

Re: Question on sorting

2004-11-30 Thread Eddie Corns
wes weston <[EMAIL PROTECTED]> writes: >Lad wrote: >> Hi, >> I have a file of records of 4 fields each. >> Each field is separated by a semicolon. That is >> >> Filed1;Ffield2;Field3;Field4 >> >> But there may be also empty records such as >> >> (only semicolons). >> >> For sorting I used