Below are some more functions.
1. typecode :- This function returns the data type by which array is initialised.
2. itemsize :- This function returns size in bytes of a single array element.
3. buffer_info() :- Returns a tuple representing the address in which array is stored and number of elements in it.
The datatype of array is : i The itemsize of array is : 4 The buffer info. of array is : (29784224, 6)
Instead of import array, we can also use * to import array.
array('i', [1, 2, 3, 1, 2, 5])
4. count() :- This function counts the number of occurrences of argument mentioned in array.
5. extend(arr) :- This function appends a whole array mentioned in its arguments to the specified array.
The occurrences of 1 in array is : 2 The modified array is : 1 2 3 1 2 5 1 2 3
6. fromlist(list) :- This function is used to append a list mentioned in its argument to end of array.
7. tolist() :- This function is used to transform an array into a list.
The modified array is : 1 2 3 1 2 5 1 2 3 The new list created is : 1 2 3 1 2 5 1 2 3
This article is contributed by Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Complex Numbers in Python | Set 2 (Important Functions and Constants)
- Array in Python | Set 1 (Introduction and Functions)
- Mathematical Functions in Python | Set 4 (Special Functions and Constants)
- Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions)
- Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions)
- Mathematical Functions in Python | Set 1 (Numeric Functions)
- Important differences between Python 2.x and Python 3.x with examples
- Python Inner Functions
- Functions in Python
- Log functions in Python
- Iterator Functions in Python | Set 1
- Partial Functions in Python
- Decimal Functions in Python | Set 1
- Operator Functions in Python | Set 1
- First Class functions in Python
- Operator Functions in Python | Set 2
- Bisect Algorithm Functions in Python
- Python | startswith() and endswith() functions
- Python - Invoking Functions with and without Parentheses
- Higher Order Functions in Python
Improved By : utkarshmalik31