Python: ord() function
ord() function
The ord() function is used to get an integer representing the Unicode code point of that character.
Version:
(Python 3.2.5)
Syntax:
ord(c)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
c | Any character of length 1. | Required | String |
Return value:
Returns an integer representing the Unicode code point of the given Unicode character.
Example: Python ord() function
# code point of integer
print(ord('7'))
# code point of alphabet
print(ord('B'))
# code point of character
print(ord('&'))
Output:
55 66 38
Python Code Editor:
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Returns the symmetric difference between two lists, after applying the provided function to each list element of both:
Example:
def tips_symmetric_difference_by(p, q, fn): _p, _q = set(map(fn, p)), set(map(fn, q)) return [item for item in p if fn(item) not in _q] + [item for item in q if fn(item) not in _p] from math import floor print(tips_symmetric_difference_by([4.2, 2.4], [4.6, 6.8],floor))
Output:
[2.4, 6.8]
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook