Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 23 Aug 2014, 11:42
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Python : Changing Global Variable's Value from a function
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
suttiwit

Joined: 11 Jul 2013
Posts: 27
Location: Chiang Mai, Thailand

PostPosted: Fri 06 Sep 2013, 00:45    Post subject:  Python : Changing Global Variable's Value from a function
Subject description: How do I do it?
 

How do I change Global Variable's Value (that is situated outside of any functions) from within a function?

Is it possible? How can I do it?

One thing: Don't show me better practices.

Thanks
Back to top
View user's profile Send private message Visit poster's website 
suttiwit

Joined: 11 Jul 2013
Posts: 27
Location: Chiang Mai, Thailand

PostPosted: Fri 06 Sep 2013, 01:54    Post subject: Got it solved.  

Got it solved now.
What I did is declare the global variable (eg. gvar) like this in a function:
Code:
global gvar


Pretty cool.
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0414s ][ Queries: 11 (0.0092s) ][ GZIP on ]