doug shawhan wrote:
> I am in the middle of a project that requires me to send and retrieve
> information from a machine connected to a serial port. My problems are
> these:
>
> 1. I cannot send control characters
> 2. I cannot read data streaming from the serial port
>
>
> I have been doing f
Greetings.
I am seeking book recommendations or preferrably online tutorials
to help me learn Java.
Company under new management and most likely would be moving
to Java and .NET
I came from Visual Basic 6 to Python and had little problems which
is why I love Python.
> I have a list that I want to change in a for loop.
Thats nearly always a bad thing to do.
Its like the old cartoon of the guy vcutting off the
branch of the tree while sitting on it. Python can
get very confused.
Either make a copy and change the copy or use
a while loop and an index.
Howe
I am in the middle of a project that requires me to send and retrieve
information from a machine connected to a serial port. My problems are
these:
1. I cannot send control characters
2. I cannot read data streaming from the serial port
I have been doing fine with:
os.system("echo '5' >/dev/tty
Wow! I checked the list at lunchtime and there were only a few things
here, then I check again now and lots of stuff from my tutor! Fortunately
most of it has been answered already - thanks folks - but I feel honour
bound to contribute something...
> What is the difference between,
>
def
Payal:
> -Original Message-
> Date: Mon, 17 Apr 2006 13:24:31 -0400
> From: Payal Rathod <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] functions in Python
> To: Steve Nelson <[EMAIL PROTECTED]>
> Cc: "Python\[Tutor\]"
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-a
Very true.
Paul
Kent Johnson wrote:
> Paul D. Eden wrote:
>
>>Lists are mutable, you are right.
>>
>>But the code you gave does not change the list. It changes the variable
>>element which is separate from the list myList.
>>
>>If you want to change the list try something like this:
>>
>>mylis
Paul D. Eden wrote:
> Lists are mutable, you are right.
>
> But the code you gave does not change the list. It changes the variable
> element which is separate from the list myList.
>
> If you want to change the list try something like this:
>
> mylist = [ 'One', ' two', ' three ' ]
On Mon, 17 Apr 2006, Alan Gauld wrote:
> a = 123456.78
> print "%g\n%e\n%f" % (a,a,a)
> > 123457
> > 1.234568e+005
> > 123456.78
>
> >Float number loses digits and becomes integer in the output ?
>
> Yep, I am rapidly coming to the comnclusion that %g is broken
> in Python. I must
Paul D. Kraus wrote:
> I have a list that I want to change in a for loop. It changes in the
> loop but the changes are not persistant outside of the loop.
> I thought lists were mutuable objects
They are.
> so I am a bit confused.
>
> Sample Code
> #!/usr/bin/env python
> """ Testing lists ""
Lists are mutable, you are right.
But the code you gave does not change the list. It changes the variable
element which is separate from the list myList.
If you want to change the list try something like this:
mylist = [ 'One', ' two', ' three ' ]
print mylist
newlist = []
for elemen
I have a list that I want to change in a for loop. It changes in the loop but the changes are not persistant outside of the loop.I thought lists were mutuable objects so I am a bit confused.Sample Code#!/usr/bin/env python
""" Testing lists """mylist = [ 'One ', ' two', ' three ' ]prin
This only happens because the python interactive command-line (what you
get when you just type 'python' in a terminal window) prints return
values automatically for you.
If you were executing
f(4)
in a program/script, the return value would be lost.
Paul
Payal Rathod wrote:
> On Mon, Apr 17,
On Mon, 17 Apr 2006, Payal Rathod wrote:
> What is the difference between,
>
def f(x):
> ... return x
> ...
f(4)
> 4
>
def f(x):
> ... print x
> ...
f(4)
> 4
>
> Both give same results.
Clarification. Both "show" the same results from the interpreter. From
what yo
> Sorry, but you have confused me more ;) Can you give an simple example
> of just function() ? Where can it be useful?
>
> And when you say it returns a value, what do you mean by that? return to
> whom and what exactly?
One view that's common is the idea that a function is a box that takes an
On Mon, Apr 17, 2006 at 05:42:05PM +0100, Steve Nelson wrote:
> When you define a function, you are writing a block of code which you
> can ask to perform a task. The task may be simple, and not require
> any additional information, or it may be more complex and need
> information.
What is the di
On Mon, Apr 17, 2006 at 05:10:51PM +0100, Robert Schumann wrote:
> You could say "I kick" (which is like func(), because you're not
> specifying an object to operate on) or your could say "I kick the
> ball" (in which case x = "the ball").
>
Sorry, but you have confused me more ;)
Can you give
Payal Rathod wrote:
> Hi,
> I am now reading Alan's tut on Python, before that I have read a few other
> tuts too.
> But I am not getting functions exactly. I mean what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
>
>
> When to use which? (please
On Mon, Apr 17, 2006 at 05:02:07PM +0100, Adam wrote:
> The x is a name for a value that you pass in to the function. To call
> the first function you would do
> >>> func()
>
> and the second function:
> >>> func(5) # 5 is just an example it could be any value depending on
> the function.
Sorry b
Sorry - including list.
On 4/17/06, Payal Rathod <[EMAIL PROTECTED]> wrote:
> what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
>
When you define a function, you are writing a block of code which you
can ask to perform a task. The task may be si
On 17/04/06, Payal Rathod <[EMAIL PROTECTED]> wrote:
> Hi,
> I am now reading Alan's tut on Python, before that I have read a few other
> tuts too.
> But I am not getting functions exactly. I mean what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
> ...
Hi,
I am now reading Alan's tut on Python, before that I have read a few other tuts
too.
But I am not getting functions exactly. I mean what is the difference between,
def func():
and
def func(x):
When to use which? (please do not say "returns a value" for I do not un
> I am referring to Stack Diagrams
from> http://www.ibiblio.org/obp/thinkCSpy/chap03.htm#11>> I did not understood this, please explain
me with an exampleThe diagram he goives is an example but I'll try to
reiterate slightly differently.
First the context:
def printTwice(bruce):
print
a = 123456.78
print "%g\n%e\n%f" % (a,a,a)
> 123457
> 1.234568e+005
> 123456.78
>Float number loses digits and becomes integer in the output ?
Yep, I am rapidly coming to the comnclusion that %g is broken
in Python. I must do some tests with gcc to see what it does
with %g, it may
>> query = '''UPDATE cost_grid
>>SET cost_1 = %s
>>WHERE cost_grid_id = %s
>>AND finish_dro = %s % ( a,c,b)
>> c.execute(query)
>
> Yikes! Alan! Certainly you know what an SQL injection attack is? And what
> if the data contains special characte
> >>> print "%14.3g\n%14.3e\n%14.3f" % (bignum,bignum,bignum)> 1.23e+009
>1.235e+009> 1234567898.235>> But in practice, we do not know how big is the data in advance when> doing scientific computation in a compiled program.That is irrelevant, the format you display the data in has
no b
Hi All
I am referring to Stack Diagrams from
http://www.ibiblio.org/obp/thinkCSpy/chap03.htm#11
I did not understood this, please explain me with an example
Thanks in Advance
Regards
Kaushal
___
Tutor maillist - Tutor@python.org
http://mail.python.
Dude, you've still got your trailing comma in stat. Get rid of it.
If I jump into MySQL, here's an example -
create table a (a int, b int); OK
insert into a values (5, 4); OK
insert into a values(5, 4,); Syntax error
Try something like this - it's more scalable too.
def generateSQL(data):
28 matches
Mail list logo