Newbie asks(2): How to do this line of C in Py?

Peter Hansen peter at
Tue Jul 10 23:23:25 EDT 2001

David Bolen wrote:
> "Steve S.L. Wong" <sailwong at> writes:
> > if sscanf(command,"%c%d",&c,&d) != 2 {
> > }
> You seem to be posting a lot of one line translation requests - are
> you trying to get a program translated to Python one line at a time?

Not to mention that he doesn't seem to be learning from the previous
responses, or showing any indication of having tried himself first.
(Four hours early the sscanf(x, "%d") variant was posted and applying
that to this isn't a reach, given Alex' answer.)

Steve, maybe you could spend a bit of time searching the documentation
for assistance before asking these questions.  Then, when you've 
put a small bit of effort in (during which time you'll doubtless
learn all kinds of other stuff about Python), post here with 
some kind of "I tried this XXXX but it didn't work they
way I expected... Can anyone help please?"

It's also fairly customary and polite to let your assistants know
a little background on the nature of your task at hand.  Are we
really translating a C program one line at a time?  

Not that that's realy a problem in c.l.p, but maybe you could let 
us know what the program does?  

Or will it spoil the punchline?  <grin>

Peter Hansen, P.Eng.
peter at

More information about the Python-list mailing list