On 08/25/2010 01:25 AM, Nitin Das wrote:
The problem with this while loop is if your random value doesn't lie
between the mentioned range then ur 100% cpu would be utilized. The
one thing u can do is to sleep for some time lets say 0.5 sec after
every while loop iteration , in this case ur cpu
The problem with this while loop is if your random value doesn't lie between
the mentioned range then ur 100% cpu would be utilized. The one thing u can
do is to sleep for some time lets say 0.5 sec after every while loop
iteration , in this case ur cpu utilization will go down.
--nitin
On Mon, A
If it is in the sys.path you should import it: *import ex1*.
Then execute something like *ex1.main()* if you did a main().
Other python */ex.py* should world.
Regards
Karim
On 08/25/2010 05:22 AM, Carter Danforth wrote:
Hi everyone,
This is my first email to group - I'm just starting to pick
Thanks Alan for you advice!
Our environment is secured because the program is only for internal use.
We are supporting electronic designers. Nobody at work will write delete
codes inside (I hope). But, sure, I will check configParser module. I wanted
a straight forward config file because for TC
Hi everyone,
This is my first email to group - I'm just starting to pick up Python and
I'm going through the exercises in Zed Shaw's "Learn Python the Hard Way"
ebook. Anyhow, I can't seem to be executing any files in terminal for some
reason, in this case the file ex1.py:
C:\Users\Carter Danfort
A bit more work than I expected, but at least I have an idea what to do now.
I'm working on writing a DVB binding based on the V4L2 binding you mentioned,
currently about 30% complete - I can query the card's status! :)
Thanks for the help so far, might post again if I run into more trouble.
-J
Got it. Thanks everyone!
On Tue, Aug 24, 2010 at 6:22 PM, Steven D'Aprano wrote:
> On Wed, 25 Aug 2010 02:23:10 am Nitin Das wrote:
> > alternatively you can use the lambda , reduce function for summing up
> > all the numbers in a list for e.g:-
> >
> > lis = [1,2,3,4,5]
> > p = reduce(lambda x,
"Joe Veldhuis" wrote
control a piece of hardware using ioctl's on its device node.
I've never tried this from Python but
#include
fd = open("/dev/dvb/adapter1/frontend0", O_RDWR)
Notice the fd - that means file descriptor not file pointer.
So ioctl takes a file descriptor in C and
"Karim" wrote
>>> import params
>>> dir(params)
['EntryTextMail', 'EntryTextName', '__builtins__', '__doc__',
But the file to import should have '.py' extension (.py) (if
there is a way to avoid that I wanted to use a 'hidden' file kind of
".config" ,
You can exec a file and you can read
On Wed, 25 Aug 2010 02:23:10 am Nitin Das wrote:
> alternatively you can use the lambda , reduce function for summing up
> all the numbers in a list for e.g:-
>
> lis = [1,2,3,4,5]
> p = reduce(lambda x,y : x+y, lis)
>
> p will have the value = 15.
Sure, you *can* do this, by why would you re-inve
On 25 August 2010 00:04, Joe Veldhuis wrote:
> Hello to all. I'm working on writing a tool that will control a piece of
> hardware using ioctl's on its device node. Specifically, I'm trying to
> configure and tune a DVB-S receiver on Linux.
>
> Just for starters, I want to try opening the fronte
On Wed, 25 Aug 2010 01:44:22 am Evert Rol wrote:
> Why are you returning -1 here?
> -1 is a valid list index.
So? str.find() does the same thing. It guarantees to only return 0 or
positive indexes if it finds the substring, and only returns -1 to
indicate not found.
--
Steven D'Aprano
__
Hello to all. I'm working on writing a tool that will control a piece of
hardware using ioctl's on its device node. Specifically, I'm trying to
configure and tune a DVB-S receiver on Linux.
Just for starters, I want to try opening the frontend and setting the LNB
voltage. An example in C:
###
after tests I get the following:
>>> import params
>>> dir(params)
['EntryTextMail', 'EntryTextName', '__builtins__', '__doc__',
'__file__', '__name__', '__package__']
>>> params.EntryTextName
'myName'
>>> params.EntryTextMail
'mym...@gmail.com'
But the file to import should have '.py' extens
Correction indents disappear (sic !) and lines are inverted (my mistake too)
:o):
def sourceConfigGui(mySourceFile,path_to_mysourcefile):
import sys
sys.path.append(path_to_mysourcefile)
import mySourceFile
Karim
On 08/24/2010 09:28 PM, Karim wrote:
Ok I find a solut
Oh, stupid me forgot the error message. Well, for some odd reason it works
now, but there are still some issues. When I tried it just a few minutes
ago, it worked fine, it seemed to me.
If anyone have any tips, please let me know. Thanks everyone for the tips.
On Tue, Aug 24, 2010 at 2:24 PM,
wrot
Ok I find a solution (need to test it) that seems correct:
Suppose we have a python file mySourceFile with this setting:
EntryTextName = "myName"
EntryTextMail = "mym...@gmail.com"
In the calling script or main python file we could define a function
sourceConfigGui as follow:
def sourceCo
aug dawg wrote on 08/24/2010 01:55:14 PM:
> Now it says that the variable adder is not defined. Does anyone know
about this?
>
It is best if you send the full error message, it helps pinpoint the
problem.
my copy of your code was:
database = []
datafile = open('/home/~/the-db/data')
for line i
Thank you Alan for your answer.
In fact I want to do it in python format.
I want to source it (I will declare it each
input as a python variable).
I don't want to parse it. I just want to source it
like an external file in bash for example.
Is there a way to not use string evaluation. But really
"Karim" wrote
I am figuring this out. I want a sort of file who store values
entered previously in a gui.
Thats easy enough - have you succeeded with this bit - check the
file with a text editor...
Th e next time the user launch his gui in the same directory the gui
load the previous value
"aug dawg" wrote
select-db = raw_input("Which database to add to? >> ")
SyntaxError: can't assign to operator
I think it might be the >> at the end, but when I try it in the
Python
interpreter, it works fine.
You have a minus sign in your variable name - at least thats
how Python sees
Now it says that the variable adder is not defined. Does anyone know about
this?
On Tue, Aug 24, 2010 at 1:40 PM,
wrote:
>
> aug dawg wrote on 08/24/2010 01:13:01 PM:
>
>
> > It's not catching that, but I haven't gotten there with the bugs yet. One
> more thing I can't figure out.
>
> >
> > line
aug dawg wrote on 08/24/2010 01:13:01 PM:
> It's not catching that, but I haven't gotten there with the bugs yet.
One more thing I can't figure out.
>
> line 11
> select-db = raw_input("Which database to add to? >> ")
> SyntaxError: can't assign to operator
>
> I think it might be the >> at
"Roelof Wobben" wrote
But it looks like it's in a indefinitive loop.
What went wrong here ?
When debugging this kind of thing insert a raw_input() statement
in the loop(to force a pause) and just before it print out the key
variables. That way you can see what is happening and what is
not
Hello All,
I am figuring this out. I want a sort of file who store values entered
previously in a gui.
Th e next time the user launch his gui in the same directory the gui
load the previous
value from this file. Is there any modules in Tkinter for that? I
suppose the file could
be in xml form
>>> I found it.
>>
>> Good.
>> Few generic comments nonetheless, just for the fun of it ;-).
>>
>>> This one does the trick :
>>>
>>> def find(strng, ch, start, step=1):
>>> index=start
>>> while 0 <= index < len(strng):
>>> if strng[index] == ch:
>>> return index
>>> index += step
>>> return -
It's not catching that, but I haven't gotten there with the bugs yet. One
more thing I can't figure out.
line 11
select-db = raw_input("Which database to add to? >> ")
SyntaxError: can't assign to operator
I think it might be the >> at the end, but when I try it in the Python
interpreter, it
Oh yeah. That was just a comment that I forgot to take out.
On Tue, Aug 24, 2010 at 1:01 PM, Walter Prins wrote:
>
>
> On 24 August 2010 17:47, aug dawg wrote:
>
>> if searcher in database:
>>> # Figure this out.
>>> if "exit database" in command:
>>> print "Bye!"
>>> sys.exit()
>>>
>>
> Th
On Tue, Aug 24, 2010 at 12:44 PM, aug dawg wrote:
> if searcher in database:
>> # Figure this out.
>>
>> You need some sort of actual Python statement there as a placeholder -
even just "print()".
--
www.fsrtechnologies.com
___
Tutor maillist - Tut
> The other day, I wrote a little database just to fiddle around,
> but when I try to run it it says that it has an unexpected indent.
> From what I can tell, it doesn't. Here's the code. I'm using SPE.
In the future, you should copy/paste error message you get into
your email. This way it ind
On 24 August 2010 17:47, aug dawg wrote:
> if searcher in database:
>> # Figure this out.
>> if "exit database" in command:
>> print "Bye!"
>> sys.exit()
>>
>
The first thing that caught my eye was the "#figure me out" line -- python
is expecting a statement there, a comment doesn't count. You
It says that it's on line 25, on the print("Bye!").
Forgot to say that.
On Tue, Aug 24, 2010 at 12:44 PM, aug dawg wrote:
> The other day, I wrote a little database just to fiddle around, but when I
> try to run it it says that it has an unexpected indent. From what I can
> tell, it doesn't. He
The other day, I wrote a little database just to fiddle around, but when I
try to run it it says that it has an unexpected indent. From what I can
tell, it doesn't. Here's the code. I'm using SPE.
database = []
datafile = open('/home/~/the-db/data')
for line in datafile:
database.append(line)
whi
> I found it.
Good.
Few generic comments nonetheless, just for the fun of it ;-).
> This one does the trick :
>
> def find(strng, ch, start, step=1):
> index=start
> while 0 <= index < len(strng):
> if strng[index] == ch:
> return index
> index += step
>
Hello,
I found it.
This one does the trick :
def find(strng, ch, start, step=1):
index=start
while 0 <= index < len(strng):
if strng[index] == ch:
return index
index += step
return -2
fruit=""
letter=""
fruit= raw_input("Enter a sort of fruit:
On Tue, Aug 24, 2010 at 9:53 PM, Nitin Das wrote:
> alternatively you can use the lambda , reduce function for summing up all
> the numbers in a list for e.g:-
>
> lis = [1,2,3,4,5]
>
> p = reduce(lambda x,y : x+y, lis)
>
> p will have the value = 15.
>
Another approach,
>>> lis = [1,2,3,4,5]
>
alternatively you can use the lambda , reduce function for summing up all
the numbers in a list for e.g:-
lis = [1,2,3,4,5]
p = reduce(lambda x,y : x+y, lis)
p will have the value = 15.
--nitin
On Mon, Aug 23, 2010 at 9:05 PM, aug dawg wrote:
> Oh okay, sorry about that.
>
> Thanks for the
> > > > > def find(strng, ch, start, step=1):
> > > > > index = start
> > > > The problem lies here, if you do a print on index, it never gets past
> > > > the first index of the number, so
> > > > your while loop below goes into an infinite loop.
> > > >
> > > > For example:
> > > > find('starfru
On Tue, Aug 24, 2010 at 9:54 AM, Triantafyllos Gkikopoulos <
t.gkikopou...@dundee.ac.uk> wrote:
> Hi,
>
> I am looking for an alternative to:
>
>
>
> Please consider the environment. Do you really need to print this email?
>
>
>
> >>>
> Subject: Re: [Tutor] FW: find() problem
> From: evert@gmail.com
> Date: Tue, 24 Aug 2010 17:03:07 +0200
> CC: tutor@python.org
> To: rwob...@hotmail.com
>
> > > > def find(strng, ch, start, step=1):
> > > > index = start
> > > The problem lies here, if you do a print on index, it never
Hi,
I am looking for an alternative to:
Please consider the environment. Do you really need to print this email?
>>> listx=[[[] for k in range(ds)] for j in range(i)]
as right now I am getting a Memory error on this, I tried
> > > def find(strng, ch, start, step=1):
> > > index = start
> > The problem lies here, if you do a print on index, it never gets past
> > the first index of the number, so
> > your while loop below goes into an infinite loop.
> >
> > For example:
> > find('starfruit','t',0) <- First time wil
From: rwob...@hotmail.com
To: obe...@gmail.com
Subject: RE: [Tutor] find() problem
Date: Tue, 24 Aug 2010 12:25:24 +
> Date: Tue, 24 Aug 2010 08:09:54 -0400
> Subject: Re: [Tutor] find() problem
> From: obe...@gmail.com
> To: rwob...@hotmail.com
>
> > I will try again.
> >
> > def
Hello,
I have this exercise :
Now rewrite the count_letters function so that instead of traversing the
string, it repeatedly calls find (the version from Optional parameters), with
the optional third parameter to locate new occurences of the letter being
counted.
And I have this
44 matches
Mail list logo