Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread John Fouhy
On 12/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > I don't suppose that anyone has a fix for me eh? I've tried about all I > can think of and I'd like to be able to give this program a trial > tomorrow when I get back to work.. sure would save me some time :] Will there be internal blanks? Yo

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
I don't suppose that anyone has a fix for me eh? I've tried about all I can think of and I'd like to be able to give this program a trial tomorrow when I get back to work.. sure would save me some time :] On Mon, 2006-09-11 at 17:48 -0700, Chris Hengge wrote: > Hmm... ok... after some thought... t

Re: [Tutor] foreach loops

2006-09-11 Thread Jordan Greenberg
Christopher Spears wrote: > Hmmm...Perl is probably a bad example. My apologies. > I was thinking more along the lines of this: > > A C++ for loop: > > #include > > using std::cout; > > int main() { > > for (int i = 0; i < 10; i++) { > cout << i << "\n"; > }

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
Christopher Spears wrote: > Hmmm...Perl is probably a bad example. My apologies. > I was thinking more along the lines of this: > > A C++ for loop: > > #include > > using std::cout; > > int main() { > > for (int i = 0; i < 10; i++) { > cout << i << "\n"; > } >

Re: [Tutor] foreach loops

2006-09-11 Thread Christopher Spears
Hmmm...Perl is probably a bad example. My apologies. I was thinking more along the lines of this: A C++ for loop: #include using std::cout; int main() { for (int i = 0; i < 10; i++) { cout << i << "\n"; } return 0; } __

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
Danny Yoo wrote: > >> Does python have foreach loops? I don't see any mention of them in the >> docs. Am I going to have to use Perl (gasp!) if I want my beloved >> foreach loop? >> > > Can you show an example of a Perl foreach loop? Perhaps someone can help > translate it into idioma

Re: [Tutor] foreach loops

2006-09-11 Thread Danny Yoo
> Does python have foreach loops? I don't see any mention of them in the > docs. Am I going to have to use Perl (gasp!) if I want my beloved > foreach loop? Can you show an example of a Perl foreach loop? Perhaps someone can help translate it into idiomatic Python. Good luck!

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Danny Yoo
> Gee, Danny, it's hard to disagree with you when you quote me in support > of your argument, but...the characters() method is probably called only > once or twice per tag, and the string is reinitialized for each tag. So > this seems unlikely to be the culprit. Ah, didn't see those; that'll

[Tutor] foreach loops

2006-09-11 Thread Christopher Spears
Does python have foreach loops? I don't see any mention of them in the docs. Am I going to have to use Perl (gasp!) if I want my beloved foreach loop? -Chris ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] urllib

2006-09-11 Thread Patricia
Hi, I have used urllib and urllib2 to post data like the following: dict = {} dict['data'] = info dict['system'] = aname data = urllib.urlencode(dict) req = urllib2.Request(url) And to get the data, I emulated a web page with a submit button: s = "" s += "" s += "" s += ""

Re: [Tutor] encoding

2006-09-11 Thread Kent Johnson
Jose P wrote: > watch this example: > a=['lula', 'cação'] print a > ['lula', 'ca\xc3\xa7\xc3\xa3o'] print a[1] > cação > > > when i print the list the special characters are not printed correctly! When you print a list, it uses repr() to format the contents of the list; when yo

[Tutor] encoding

2006-09-11 Thread Jose P
watch this example: >>> a=['lula', 'cação'] >>> print a ['lula', 'ca\xc3\xa7\xc3\xa3o'] >>> print a[1] cação when i print the list the special characters are not printed correctly! But if i print only the list item that has the special charaters it runs OK. How do i get list print correctly?

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Hmm... ok... after some thought... this is what I'm looking for   #some great line that gives me an int for the number of not null cells intLastUsedRow = xlSht.Cells.LastValue #Made this up, but basically what I need.   I need to iterate through a range() because I dont know another good way to tel

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Kent Johnson
Danny Yoo wrote: > If I really had to guess, without profiling information, I'd take a very > close look at the characters() method: it's doing some string > concatentation there that may have very bad performance, depending on the > input. See: > > http://mail.python.org/pipermail/tutor

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Danny Yoo
> terribly slow. Doclifter itself take around a second to parse the troff > file, but my few lines of code take 25 seconds to parse the resultant > xml. I've pasted the code at http://pastebin.ca/166941 and I'd like to > hear from you how I could possibly optimize it. Hi Tiago, Before we go an

Re: [Tutor] Java: (and python ?) nearer measles than coffee

2006-09-11 Thread Danny Yoo
>> some more people are looking for a mnemonic-language which should >> optimized cross-compile to something with multiplatform-capability like >> Java. Please let me know, if I am entirely wrong. > > I'm not really sure what you are asking. Many people find Python to be > useful and enjoyable fo

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Kent Johnson
Tiago Saboga wrote: > Ok, the guilty line (279) has a "©" that was probably defined in the > dtd, > but as it doesn't know what is the right dtd... But wait... How does python > read the dtd? It fetches it from the net? I tried it (disconnected) and the > answer is yes, it fetches it from the n

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Just tried that (pretty sure I already did, but hey... I could have goofed it)   No go  On 9/11/06, Alan Gauld <[EMAIL PROTECTED]> wrote: I'm no expert in Excel programming but I assum,e you triedthe obvious:> I'm looking for something more like > try:#Loop until rows are null>while row in xlwk

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
from win32com.client import Dispatch soo... that would be com.. sorry about that.. xlSht is the worksheet I'm currently reading from.   On 9/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> This is what I have, but it requires me to know the end of the column> I'm working with,

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Alan Gauld
I'm no expert in Excel programming but I assum,e you tried the obvious: > I'm looking for something more like > try:#Loop until rows are null >while row in xlwksht != null > #Write each row, incriment 1+row in column 5 > print >> file, "'" + %s + "',", % > (xlSht.Cells(1+row,5

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Kent Johnson
Chris Hengge wrote: > This is what I have, but it requires me to know the end of the column > I'm working with, which changes. > > try:#Loop through the rows from 6 -> 25 > for row in range(6, 25): > #Write each row, increment 1+row in column 5 > print >> file, "(%d) => %s" %

[Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
This is what I have, but it requires me to know the end of the column I'm working with, which changes.   try:#Loop through the rows from 6 -> 25    for row in range(6, 25):    #Write each row, increment 1+row in column 5    print >> file, "(%d) => %s" % (row, xlSht.Cells (1+row, 5).Value)

[Tutor] Java: (and python ?) nearer measles than coffee

2006-09-11 Thread Jonathon Sisson
Hrmmm...my opinion is that you shouldn't waste your time with Java (sorry to any Java coders on this list). It's entirely too automated for my tastes (automatic garbage collection, transparent pointers, etc...). To quote an unknown author who was quite the anti-OOP programmer, "it made me want to

Re: [Tutor] Java: (and python ?) nearer measles than coffee

2006-09-11 Thread Kent Johnson
Klaus Ramelow wrote: > Sometimes I have also some - or more - problems trying digesting python > and feeling totally blocked. > > My programming experience (beginning at the card-reader era) > main-frame, mini and micro : > Bit / Byte / Word system-programming via switch-console followed by > Ass

[Tutor] Java: (and python ?) nearer measles than coffee

2006-09-11 Thread Klaus Ramelow
Sometimes I have also some - or more - problems trying digesting python and feeling totally blocked. My programming experience (beginning at the card-reader era) main-frame, mini and micro : Bit / Byte / Word system-programming via switch-console followed by Assembler and commercial software usin

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Tiago Saboga
Em Segunda 11 Setembro 2006 12:59, Kent Johnson escreveu: > Tiago Saboga wrote: > > Em Segunda 11 Setembro 2006 12:24, Kent Johnson escreveu: > >> Tiago Saboga wrote: > >>> Em Segunda 11 Setembro 2006 11:15, Kent Johnson escreveu: > Tiago Saboga wrote: > How big is the XML? 25 seconds is

Re: [Tutor] Injecting Data into XML Files

2006-09-11 Thread Kent Johnson
William O'Higgins Witteman wrote: > On Mon, Sep 11, 2006 at 02:38:46PM -0400, Kent Johnson wrote: >> Note that ET uses the URI of the namespace, not the short name. > > That's a huge help, thank you. What would I do if there is no namespace > for the given documents? I find that a great deal of

Re: [Tutor] Injecting Data into XML Files

2006-09-11 Thread William O'Higgins Witteman
On Mon, Sep 11, 2006 at 02:38:46PM -0400, Kent Johnson wrote: >>>On Mon, Sep 11, 2006 at 12:11:37PM -0400, William O'Higgins Witteman >>>wrote: What I want is to open each document and inject some data between specific sets of tags. I've been able to parse these documents, but I am no

Re: [Tutor] Injecting Data into XML Files

2006-09-11 Thread Kent Johnson
William O'Higgins Witteman wrote: > On Mon, Sep 11, 2006 at 09:57:28AM -0700, Dave Kuhlman wrote: >> On Mon, Sep 11, 2006 at 12:11:37PM -0400, William O'Higgins Witteman wrote: >>> I have a large number of XML documents to add data to. They are >>> currently skeletal documents, looking like this:

Re: [Tutor] Injecting Data into XML Files

2006-09-11 Thread William O'Higgins Witteman
On Mon, Sep 11, 2006 at 09:57:28AM -0700, Dave Kuhlman wrote: >On Mon, Sep 11, 2006 at 12:11:37PM -0400, William O'Higgins Witteman wrote: >> I have a large number of XML documents to add data to. They are >> currently skeletal documents, looking like this: >> >> >> >> http://www.w3.org/1999/02

Re: [Tutor] Injecting Data into XML Files

2006-09-11 Thread Dave Kuhlman
On Mon, Sep 11, 2006 at 12:11:37PM -0400, William O'Higgins Witteman wrote: > I am wrestling with the incredibly vast array of XML parsing and writing > documentation, and I'm not seeing (or perhaps not understanding) what > I'm looking for. Here's the situation: > > I have a large number of XML

[Tutor] Injecting Data into XML Files

2006-09-11 Thread William O'Higgins Witteman
I am wrestling with the incredibly vast array of XML parsing and writing documentation, and I'm not seeing (or perhaps not understanding) what I'm looking for. Here's the situation: I have a large number of XML documents to add data to. They are currently skeletal documents, looking like this:

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Kent Johnson
Tiago Saboga wrote: > Em Segunda 11 Setembro 2006 12:24, Kent Johnson escreveu: >> Tiago Saboga wrote: >>> Em Segunda 11 Setembro 2006 11:15, Kent Johnson escreveu: Tiago Saboga wrote: How big is the XML? 25 seconds is a long time...I would look at cElementTree (implementation of Ele

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Tiago Saboga
Em Segunda 11 Setembro 2006 12:24, Kent Johnson escreveu: > Tiago Saboga wrote: > > Em Segunda 11 Setembro 2006 11:15, Kent Johnson escreveu: > >> Tiago Saboga wrote: > >> How big is the XML? 25 seconds is a long time...I would look at > >> cElementTree (implementation of ElementTree in C), it is p

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Kent Johnson
Tiago Saboga wrote: > Em Segunda 11 Setembro 2006 11:15, Kent Johnson escreveu: >> Tiago Saboga wrote: >> How big is the XML? 25 seconds is a long time...I would look at >> cElementTree (implementation of ElementTree in C), it is pretty fast. >> http://effbot.org/zone/celementtree.htm > > It's abo

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Tiago Saboga
Em Segunda 11 Setembro 2006 11:15, Kent Johnson escreveu: > Tiago Saboga wrote: > > I'm still there, trying to parse man pages (I want to gather a list of > > all options with their help strings). I've tried to use regex on both the > > formatted output of man and the source troff files and I disco

Re: [Tutor] man pages parsing (still)

2006-09-11 Thread Kent Johnson
Tiago Saboga wrote: > I'm still there, trying to parse man pages (I want to gather a list of all > options with their help strings). I've tried to use regex on both the > formatted output of man and the source troff files and I discovered what is > already said in the doclifter man page: you hav

[Tutor] man pages parsing (still)

2006-09-11 Thread Tiago Saboga
I'm still there, trying to parse man pages (I want to gather a list of all options with their help strings). I've tried to use regex on both the formatted output of man and the source troff files and I discovered what is already said in the doclifter man page: you have to do a number of hints, a

Re: [Tutor] howto keep a program organised?

2006-09-11 Thread Rob Vogel
Thanks for the info. I will use a module. Regards, Rob On 9/11/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > > The functions do not share variables, I don't use global vars, and I > > don't need a new instance. > > In that case you don't need a class. > A module should do all you need by providin

Re: [Tutor] howto keep a program organised?

2006-09-11 Thread Alan Gauld
> The functions do not share variables, I don't use global vars, and I > don't need a new instance. In that case you don't need a class. A module should do all you need by providing a common namespace for your functions. > So in my case the only use of a class would be that all related usb > cod

Re: [Tutor] howto keep a program organised?

2006-09-11 Thread Kent Johnson
Rob Vogel wrote: > Thanks Alan, > > The functions do not share variables, I don't use global vars, and I > don't need a new instance. > So in my case the only use of a class would be that all related usb > code will be grouped together, even though I do not need any of the > Class special abilitie

Re: [Tutor] howto keep a program organised?

2006-09-11 Thread Rob Vogel
Thanks Alan, The functions do not share variables, I don't use global vars, and I don't need a new instance. So in my case the only use of a class would be that all related usb code will be grouped together, even though I do not need any of the Class special abilities, as far as I understand. I t

Re: [Tutor] Tutor Digest, Vol 31, Issue 26

2006-09-11 Thread Bugra Cakir
Hi,My thought is seperate main and utility functions to different files.For example there will be a Main.py and UsbUtil.py and from Main.pyyou can import usb functions. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] howto keep a program organised?

2006-09-11 Thread Alan Gauld
Hi Rob, > For example, I may need to mount the usb storage device at some > point > in the program. > For this end I made the following functions: > - usbMount() -> main function. > - usbUmount() -> main function. > - usbMounted() -> help function. Checks if usb already mounted. > - usbConnected(

Re: [Tutor] Getting Started with Python

2006-09-11 Thread Kent Johnson
tomd wrote: > Hi Will, > > do a search in the archives, plenty of similar discussions, even just > few days ago. Try http://wiki.python.org/moin/BeginnersGuide/NonProgrammers > > (Admins: consider sending a welcome message on the subscription to > each newcomer specifying usually recommended sour

[Tutor] howto keep a program organised?

2006-09-11 Thread Rob Vogel
Hello All, I have been programming with Python for a few weeks now. By now I have problems keeping my program organised. (program runs from a Linux Busybox environment). For example, I may need to mount the usb storage device at some point in the program. For this end I made the following functio

Re: [Tutor] Getting Started with Python

2006-09-11 Thread tomd
Hi Will, do a search in the archives, plenty of similar discussions, even just few days ago. Try http://wiki.python.org/moin/BeginnersGuide/NonProgrammers (Admins: consider sending a welcome message on the subscription to each newcomer specifying usually recommended sources.) > just recently hav

[Tutor] Getting Started with Python

2006-09-11 Thread Will Shattuck
Hi all, I started going through the [Tutor] archives looking for resources on where to start. I have wanted to program for many years, but only just recently have made the time. I thought through different languages to start with: C, C# (My work uses .NET), Java, Python, Ruby, and others. I thi