Re: [Tutor] int to bytes and the other way around

2009-07-06 Thread Stefan Behnel
Chris Fuller wrote: > The only things that matter are the arguments and the result. It sounds to > me > like a good case use for SWIG (http:://www.swig.org). You can do really > complicated stuff with swig, and it takes a correspondingly steep learning > curve to achieve, but doing simple stu

Re: [Tutor] Urllib, mechanize, beautifulsoup, lxml do not compute (for me)!

2009-07-06 Thread Stefan Behnel
Hi, David Kim wrote: > I have two questions I'm hoping someone will have the patience to > answer as an act of mercy. > > I. How to get past a Terms of Service page? > > I've just started learning python (have never done any programming > prior) and am trying to figure out how to open or downloa

[Tutor] Urllib, mechanize, beautifulsoup, lxml do not compute (for me)!

2009-07-06 Thread David Kim
Hello all, I have two questions I'm hoping someone will have the patience to answer as an act of mercy. I. How to get past a Terms of Service page? I've just started learning python (have never done any programming prior) and am trying to figure out how to open or download a website to scrape da

Re: [Tutor] int to bytes and the other way around

2009-07-06 Thread Chris Fuller
The only things that matter are the arguments and the result. It sounds to me like a good case use for SWIG (http:://www.swig.org). You can do really complicated stuff with swig, and it takes a correspondingly steep learning curve to achieve, but doing simple stuff is really simple. It sounds

Re: [Tutor] int to bytes and the other way around

2009-07-06 Thread Rich Lovely
2009/7/6 Timo : > I have written a program that uses a C++ module as backend. Now I found out > that I can use Python to call an underneath C lib. That's nice, so I don't > need to Popen() the C++ module. > > I have a problem though with some info that is returned (always an integer). > I'll try to

Re: [Tutor] Poor style to use list as "array"?

2009-07-06 Thread Angus Rodgers
On Mon, 6 Jul 2009 01:51:22 +0100, Rich Lovely wrote: [I wrote:] >>                if name in plural: >>                    name = plural[name] >>                else: >>                    name += 's' >This could be written more cleanly (although arguably not as readably) as > >name = plural.get(

Re: [Tutor] Popen problem with a pipe sign "|"

2009-07-06 Thread hyou
Hi Sander, My guess is that the two shell options must be treating the command string differently, thus the "|" sign has different functionalities on them. Thanks! Shawn -Original Message- From: Sander Sweers [mailto:sander.swe...@gmail.com] Sent: Monday, July 06, 2009 10:23 AM To: h

Re: [Tutor] Python Tutorials: How to create useful programs after learning the syntax?

2009-07-06 Thread Robert Berman
I have programmed since I was 21. Since I am now retired; that gives me a tad of experience in some aspects of coding. I have only been using Python for two years and I enjoy it for two reasons; the first and most important is it is fun. if you don't enjoy the language, find another one you do enjo

Re: [Tutor] Popen problem with a pipe sign "|"

2009-07-06 Thread Tim Golden
hyou wrote: Thanks for the answer! I found the problem was because I put the 2nd argument to Popen with Shell = true. Though I'm not sure why it doesn't work with Shell = true while the same setting works for other commands. There's a long-outstanding bug when shell=True is passed to subproces

Re: [Tutor] Popen problem with a pipe sign "|"

2009-07-06 Thread Sander Sweers
2009/7/6 hyou : > Do I post to the list by also replying to Python Tutor List? Yes, thanks. > Thanks for the answer! I found the problem was because I put the 2nd > argument to Popen with Shell = true. Though I'm not sure why it doesn't work > with Shell = true while the same setting works for ot

Re: [Tutor] Popen problem with a pipe sign "|"

2009-07-06 Thread hyou
Hi Sander, Do I post to the list by also replying to Python Tutor List? Thanks for the answer! I found the problem was because I put the 2nd argument to Popen with Shell = true. Though I'm not sure why it doesn't work with Shell = true while the same setting works for other commands. Thanks agai

Re: [Tutor] Poor style to use list as "array"? CORRECTION

2009-07-06 Thread bob gailer
class Coin: def __init__(self, name, value, plural=None): self.name = name self.value = value if plural: self.plural = plural else: self.plural = self.name + 's' self.count = 0 def display(self): if self.count == 0: return None if self.count == 1: return "%d %s" % (

Re: [Tutor] int to bytes and the other way around

2009-07-06 Thread Kent Johnson
On Mon, Jul 6, 2009 at 4:48 AM, Timo wrote: > I have written a program that uses a C++ module as backend. Now I found out > that I can use Python to call an underneath C lib. That's nice, so I don't > need to Popen() the C++ module. > > I have a problem though with some info that is returned (alway

Re: [Tutor] append question

2009-07-06 Thread Kent Johnson
> 2009/7/6 Steven Buck : >> # I call my data set the psid (Panel Study of Income Dynamics) >> # In Stata this would look like and NXK matrix (N observations and K >> variables) >> psid=Reader(file('data3.dta')) >> >> # I gather this next just creates a list of the variable names. >> varnames=[x.na

Re: [Tutor] append question

2009-07-06 Thread Steven Buck
Thanks for the previous responses. This isn't homework--I'm beyond coursework, although I am a newbie to Python (and I've never had to do much real programming since I've just used Stata for econometric analysis). I'm testing Python as a more powerful alternative to Stata. I've learned from the

Re: [Tutor] Python Tutorials: How to create useful programs afterlearning the syntax?

2009-07-06 Thread Alan Gauld
"Luis Galvan" wrote Hello all, this is my first time using a mailing list, so I'm not sure if I'm doing this right! Yep. You send a mail to the list, we reply,. Easy :-) One thing to remember is when you reply use "ReplyAll" on your mail tool, not simple Reply. of programming. (I'm new to pr

[Tutor] int to bytes and the other way around

2009-07-06 Thread Timo
I have written a program that uses a C++ module as backend. Now I found out that I can use Python to call an underneath C lib. That's nice, so I don't need to Popen() the C++ module. I have a problem though with some info that is returned (always an integer). I'll try to explain a bit, this is

Re: [Tutor] Python Tutorials: How to create useful programs after learning the syntax?

2009-07-06 Thread Luke Paireepinart
Luis Galvan wrote: Hello all, this is my first time using a mailing list, so I'm not sure if I'm doing this right! Everything's fine except perhaps your formatting - it's easier to read e-mails that are delineated into paragraphs rather than just a single block of text. That may be a problem o