its a global variable so do this :
COUNT = 0
def increment():
global COUNT
COUNT = COUNT+1
increment()
print COUNT
Global variables can be accessed without declaring the global but if you are going to change their values the global declaration is required.
More Related Contents:
- how to reverse a string number in python with for loop
- Sum the digits of a number
- How do you test that a Python function throws an exception?
- How to extract the decision rules from scikit-learn decision-tree?
- Pandas groupby: How to get a union of strings
- How do I tell Python to convert integers into words
- Splitting a string into words and punctuation
- Recursion and return statements
- What is the difference between ‘SAME’ and ‘VALID’ padding in tf.nn.max_pool of tensorflow?
- How to save an image locally using Python whose URL address I already know?
- Scheduling Python Script to run every hour accurately
- How do I set the figure title and axes labels font size in Matplotlib?
- Sum of list of lists; returns sum list
- List of tuples to dictionary [duplicate]
- Delete file from zipfile with the ZipFile Module
- standard_init_linux.go:178: exec user process caused “exec format error”
- sqlalchemy unique across multiple columns
- How do you create an incremental ID in a Python Class
- Why can pandas DataFrames change each other?
- Group by multiple keys and summarize/average values of a list of dictionaries
- Copying MultiIndex dataframes with pd.read_clipboard?
- How to get the scrapy failure URLs?
- Generate RFC 3339 timestamp in Python [duplicate]
- What is a “method” in Python?
- How to remove multiple indexes from a list at the same time? [duplicate]
- JSON ValueError: Expecting property name: line 1 column 2 (char 1)
- How do I extend a python module? Adding new functionality to the `python-twitter` package
- Python numpy: cannot convert datetime64[ns] to datetime64[D] (to use with Numba)
- Slicing multiple ranges of columns in Pandas, by list of names
- Keras give input to intermediate layer and get final output