(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 24 Sep 2020, 12:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Python : Changing Global Variable's Value from a function
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
suttiwit

Joined: 11 Jul 2013
Posts: 28
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: 28
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]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. 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.0853s ][ Queries: 11 (0.0560s) ][ GZIP on ]