>I'm trying to write a program w/ python that runs once a day and every time it
>does it adds 20 to a variable. How do I do this so it doesn't reset the
>variable to the original value every time I run it?
You can output the value to a file? Then re-read the file once a day and
assign that val
Hello Palmer,
>> I'm trying to write a program w/ python that runs once a day and every time
>> it does it adds 20 to a variable. How do I do this so it doesn't reset the
>> variable to the original value every time I run it?
>
>You have to read the variable from a file saved to disk, add 20,
>t
>Also, lookup cron. It will start your program at a certain time you select,
>every day
Linux system "crontab -l" to edit it "crontab -e"
Any doubts "man crontab"
This email is confidential and may be subject to privilege. If you are not the
intended recipient, please do not copy or disclose
On Mon, Aug 1, 2016 at 10:15 PM, Steven D'Aprano wrote:
> On Mon, Aug 01, 2016 at 01:26:19PM -0600, Palmer Gutke wrote:
>> I'm trying to write a program w/ python that runs once a day and every time
>> it does it adds 20 to a variable. How do I do this so it doesn't reset the
>> variable to the or
On Mon, Aug 01, 2016 at 01:26:19PM -0600, Palmer Gutke wrote:
> I'm trying to write a program w/ python that runs once a day and every time
> it does it adds 20 to a variable. How do I do this so it doesn't reset the
> variable to the original value every time I run it?
You have to read the variab
I'm trying to write a program w/ python that runs once a day and every time
it does it adds 20 to a variable. How do I do this so it doesn't reset the
variable to the original value every time I run it?
Thanks
___
Tutor maillist - Tutor@python.org
To un
On Wed, Jun 17, 2015 at 7:04 AM, Laura Creighton wrote:
> In a message of Wed, 17 Jun 2015 02:05:49 +0100, Oliver Mercer-Deadman writes:
>>Hi I am a complete newbie but am hoping to learn some python for a
>>particular project. Before I hurl myself in I would like to know if a key
>>element is goi
In a message of Wed, 17 Jun 2015 02:05:49 +0100, Oliver Mercer-Deadman writes:
>Hi I am a complete newbie but am hoping to learn some python for a
>particular project. Before I hurl myself in I would like to know if a key
>element is going to be possible.
>
>I will need to be able to use a variable
Hi I am a complete newbie but am hoping to learn some python for a
particular project. Before I hurl myself in I would like to know if a key
element is going to be possible.
I will need to be able to use a variable as the username in an email
address. E.G.
username = Input("Enter Something: ")
T
delegbede=dudupay@python.org
Date: Tue, 22 Nov 2011 23:15:49
To:
Subject: [Tutor] Variables (with lists??)
I was going over one of Derek Banas' tutorials on youtube, and came
across something I hadn't seen before. A variable with a list beside it
(see code below). He sets the variab
On 2011-11-23 05:15, Chris Kavanagh wrote:
I was going over one of Derek Banas' tutorials on youtube, and came
across something I hadn't seen before. A variable with a list beside it
(see code below). He sets the variable, customer , equal to a dict. Then
uses the variable with ['firstname'],['la
I was going over one of Derek Banas' tutorials on youtube, and came
across something I hadn't seen before. A variable with a list beside it
(see code below). He sets the variable, customer , equal to a dict. Then
uses the variable with ['firstname'],['lastname'], ect. I've never seen
this in my
bod...@googlemail.com wrote:
And presumably cleans up the leftover object with the value of 42 when it
changes to point at the 43 object?
In principle, yes, the garbage collector will destroy the no-longer used
object 42 once nothing is pointing to it any more.
But in practice, Python cache
Joel Goldstick wrote:
If a value has no name bound to it, python figures that out and destroys it
Not quite... if there is no name, or any other reference, then the
garbage collector will destroy it. But it doesn't have to be a name:
anonymous objects can live inside lists, or dicts, or sets
On Tue, Apr 19, 2011 at 2:37 PM, Joel Goldstick wrote:
>
> On Tue, Apr 19, 2011 at 3:32 PM, wrote:
>
>> And presumably cleans up the leftover object with the value of 42 when it
>> changes to point at the 43 object?
>>
>> Or does it leave all changes in memory until the program exits?
>>
>
> If a
;t let me change it
> Sent from my BlackBerry® wireless device
>
> -Original Message-
> From: Steven D'Aprano
> Sender: tutor-bounces+bodsda=ubuntu@python.org
> Date: Wed, 20 Apr 2011 04:24:03
> To: tutor
> Subject: [Tutor] Variables and constants [was Re: w
ginal Message-
From: Steven D'Aprano
Sender: tutor-bounces+bodsda=ubuntu@python.org
Date: Wed, 20 Apr 2011 04:24:03
To: tutor
Subject: [Tutor] Variables and constants [was Re: working with strings in
python3]
Rance Hall wrote:
> Variables are variable, that's why we
Rance Hall wrote:
Variables are variable, that's why we call them variable.
Constants are constant, and that's why we call them constant.
And Python has neither variables nor constants in the sense that (say)
Pascal, C or Fortran have, even though we often use the same words.
The difference
Steven D'Aprano, et al,
Thanks everyone for the thorough explanations on variable use and scope in
Python. It was enlightening...and sometimes confusing, but I'm working on that.
It just points out all the new things I have yet to learn about the language.
--
¤¤
¤ kyoboku kazeo
Jeff Honey wrote:
I have a question about where variables are exposed in python.
I have a monolothic script with a number of functions defined, can those
functions share variables? can I instantiate them outside the function of where
they are needed? do they need to be wrapped in quotes, ever?
It's pretty typical for scoping rules. If you define variables outside of your
funcs you can access them inside the func. If you want to change the value in
the function you need to declare the scope as global. If you make another
variable with the same name inside of a function it will shadow t
On 11/10/2010 10:21 AM Jeff Honey said...
I have a question about where variables are exposed in python.
You're looking for scoping rules -- see for example
http://stackoverflow.com/questions/291978/short-description-of-python-scoping-rules
where they get into some detail, but the short and o
"Jeff Honey" wrote
I have a question about where variables are exposed in python.
Take a look at the namespaces topic in my tutor for more details
but...
I have a monolothic script with a number of functions defined,
can those functions share variables?
Yes but its usually bad practice
I have a question about where variables are exposed in python.
I have a monolothic script with a number of functions defined, can those
functions share variables? can I instantiate them outside the function of where
they are needed? do they need to be wrapped in quotes, ever? For example:
blah
Alan Gauld wrote:
> "Devon MacIntyre" <[EMAIL PROTECTED]> wrote
>
>> input their own numbers to fill in the board. My problem is that I
>> can't get
>> the variables 'puzzle' and 'new_puzzle' into that function (to be
>> compared)
>> because they are not globally defined; only in 'new_sudoku'
>
"Devon MacIntyre" <[EMAIL PROTECTED]> wrote
> input their own numbers to fill in the board. My problem is that I
> can't get
> the variables 'puzzle' and 'new_puzzle' into that function (to be
> compared)
> because they are not globally defined; only in 'new_sudoku'
> function. Here's
> some se
Hello Devon,
Here's a quick [untested] push in the direction of taking the code
you gave below and modeling it as a class using an object-oriented
design. With this code, you could then create an instance of a puzzle as:
toughOne = Sudoku()
toughOne.play_game()
Within
when we say you can put all of your
functions in a class and use a class variable (in this case... self.puzzle)
- Original Message -
From: "Devon MacIntyre" <[EMAIL PROTECTED]>
To: "Kent Johnson" <[EMAIL PROTECTED]>
Cc:
Sent: Wednesday, November 28, 20
Hi,
I have two functions, 'new_sudoku' and 'play_game'. In new_sudoku, I have a
pre-determined puzzle (I wasn't able to get a randomly generated puzzle
working), as a matrix in the variable 'puzzle'. I imported the 'copy' module
and made a deep-copy of 'puzzle' to make 'new_puzzle', which randomly
"Devon MacIntyre" <[EMAIL PROTECTED]> wrote
> Just wondering, how would I get a variable out of one function and
> into
> another?
return the value from one function and pass it as an argument to the
other.
Example:
def oneFunction()
x = [1,2,3]
return x
def another(aValue):
pr
Devon MacIntyre wrote:
> Hi,
> Just wondering, how would I get a variable out of one function and into
> another?
I don't understand your description of your situation, maybe you could
show a little code as a simple example?
The usual way to get a variable out of a function is to return a valu
Sounds like an excuse for a global (aggh!) variable.
Or more properly, wrap all of the relevant functions in a class and use a
class variable for your puzzle
- Original Message -
From: "Devon MacIntyre" <[EMAIL PROTECTED]>
To:
Sent: Wednesday, November 28, 2007 4:00 PM
Hi,
Just wondering, how would I get a variable out of one function and into
another? I'm trying to make a Sudoku puzzle for Python 2.5.1, and in one
function I have the finished puzzle (as a matrix) called 'puzzle'. Using the
'copy' module I made a deep copy called 'new_puzzle'. That function is
ca
"Eli Brosh" <[EMAIL PROTECTED]> wrote
> The dir() and del work really well !
I meant to add that if you look at the names a lot then you migt
prefer PyCrust asa shell rather than IDLE. PyCrust has a small
namespace window on permanent display wich shows all of
the names dynamically in an ex
Many thanks to Bob and Kent and all the good people in the tutor forum.
The dir() and del work really well !
Eli
מאת: bob gailer [mailto:[EMAIL PROTECTED]
נשלח: ש 10/13/2007 17:35
אל: Kent Johnson
עותק לידיעה: Eli Brosh; tutor@python.org
נושא: Re: [Tutor
On Sat, Oct 13, 2007 at 11:04:05AM +0200, Eli Brosh wrote:
>
> Hello
> I am working with python interactively using IDLE.
>
> Since starting, I defined some variables:
> s='string'
> a=1
> b=[1,2]
> c=1.02
>
> and so on.
>
> Now, I want to know which variables are in my workspace.
> That is, is
"Eli Brosh" <[EMAIL PROTECTED]> wrote
> Now, I want to know which variables are in my workspace.
Try dir()
That should give you the names in the current namespace.
You will see some names you didn't define too.
dir()is a really helpful command when you want to see whats possible.
>>> dir('')
Kent Johnson wrote:
> bob gailer wrote:
>> The del statement is the way to delete variables. Since dir() gives
>> you their names one needs use eval.
>>
>> for varName in dir():
>> eval 'del ' + varName
>
> I think del globals()[varName] would work.
Yep. That was nagging a corner of my brain,
bob gailer wrote:
> The del statement is the way to delete variables. Since dir() gives you
> their names one needs use eval.
>
> for varName in dir():
> eval 'del ' + varName
I think del globals()[varName] would work.
Kent
___
Tutor maillist -
Eli Brosh wrote:
>
> Hello
> I am working with python interactively using IDLE.
>
> Since starting, I defined some variables:
> s='string'
> a=1
> b=[1,2]
> c=1.02
>
> and so on.
>
> Now, I want to know which variables are in my workspace.
> That is, is there a command similar to "who" in MATLAB ?
Eli Brosh wrote:
> I am working with python interactively using IDLE.
>
> Since starting, I defined some variables:
>
> Now, I want to know which variables are in my workspace.
RESTART
>>> dir()
['__builtins__', '__doc__', '__name__']
>>> s='string'
>>> a
Hello
I am working with python interactively using IDLE.
Since starting, I defined some variables:
s='string'
a=1
b=[1,2]
c=1.02
and so on.
Now, I want to know which variables are in my workspace.
That is, is there a command similar to "who" in MATLAB ?
I want to call "who"
and get the output:
*** Stuff deleted
Wanted to give you an update. It is working now. Thank you
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
> Actually, I started off with a dictionary with a bunch of parameters. To
> give you some background, I writing my
> first GUI, and using the parameters in a dictionary to control what box the
> GUI displays next. So, it looks
> something that looks like this:
>
> data={'position':'middle',
>
On 1/18/07, Danny Yoo <[EMAIL PROTECTED]> wrote:
> Rather than storing your data as variables, you could store it in a
> dictionary. Then you can dynamically access data however you like..
Suggesting a dictionary here is right.
** Stuff deleted about why using variables of variables is bad **
> Rather than storing your data as variables, you could store it in a
> dictionary. Then you can dynamically access data however you like..
Suggesting a dictionary here is right.
The technique in the original poster's question is deprecated and widely
known to be a Bad Idea in Perl. See Mark
On 19/01/07, Tino Dai <[EMAIL PROTECTED]> wrote:
> Hi Everybody,
>
> Is there a way to do variables of variables in python. For example in
> perl:
>
> $foo = 'bar'
> $$foo = '5'
>
> and $bar will have a value of 5. I have been search high and low for a
> simple way to do this in python?
In th
Hi Everybody,
Is there a way to do variables of variables in python. For example in
perl:
$foo = 'bar'
$$foo = '5'
and $bar will have a value of 5. I have been search high and low for a
simple way to do this in python?
-Thanks,
Tino
___
Tutor mai
> Hi, I just started picking up python
yesterday, and have already come> across something that has me
stumped. I want some code that does> this:> > a =
foo(a)> b = foo(b)> c = foo(c)> > So I try to do
this with a for loop, like so:> > for i in [a, b,
c]:> i = foo(i)> print
i # ma
Evan Klitzke wrote:
> Hi, I just started picking up python yesterday, and have already come
> across something that has me stumped. I want some code that does
> this:
>
> a = foo(a)
> b = foo(b)
> c = foo(c)
>
> So I try to do this with a for loop, like so:
>
> for i in [a, b, c]:
>i = foo(i)
Evan Klitzke wrote:
> Hi, I just started picking up python yesterday, and have already come
> across something that has me stumped. I want some code that does
> this:
>
> a = foo(a)
> b = foo(b)
> c = foo(c)
>
> So I try to do this with a for loop, like so:
>
> for i in [a, b, c]:
>i = foo(i)
Hi, I just started picking up python yesterday, and have already come
across something that has me stumped. I want some code that does
this:
a = foo(a)
b = foo(b)
c = foo(c)
So I try to do this with a for loop, like so:
for i in [a, b, c]:
i = foo(i)
print i # make sure that it worked
Ahem, we heard you the first time!
:-)
Alan G.
- Original Message -
From: "l4 l'l1" <[EMAIL PROTECTED]>
To:
Sent: Tuesday, February 15, 2005 10:47 AM
Subject: [Tutor] Variables
> How can I do it with several variables?
>
>
> I = "Joh
I am forwarding this mail, since tutor@python.org is not added by Matt Hauser.
Thank you,
Vishnu.
-Original Message-
From: Matt Hauser [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 15, 2005 7:28 PM
To: Vishnu
Subject: Re: [Tutor] Variables
#Create a list of people
whoLovesPizza
uot;I3"] = "John3"
print "%{I1}s, %{I2}s and %{I3}s used to love pizza" % name
HTH,
Vishnu
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ÃÃ ÃÃÂÂ
Sent: Tuesday, February 15, 2005 4:18 PM
To: tutor@python.org
Subject: [Tutor] Variable
How can I do it with several variables?
I = "John"
print "%s used to love pizza" % I
About 10 or more...
HELP plz :)
_
증권 정보 가장 빠르고 편하게 보실 수 있습니다. MSN 증권/투자
http://www.msn.co.kr/stock/
_
How can I do it with several variables?
I = "John"
print "%s used to love pizza" % I
About 10 or more...
HELP plz :)
_
확인하자. 오늘의 운세 무료 사주, 궁합, 작명, 전생 가이드
http://www.msn.co.kr/fortune/default.asp
___
57 matches
Mail list logo