ID EN
Diff Tools

ratio

Python 3.11

Return a measure of the sequences’ similarity as a float in the range [0, 1].

Syntax

PYTHON
ratio()

Examples

Example 1
PYTHON
>>> SequenceMatcher(None, 'tide', 'diet').ratio()
0.25
>>> SequenceMatcher(None, 'diet', 'tide').ratio()
0.5

See Also

get_matching_blocks() get_opcodes() quick_ratio() real_quick_ratio() ratio()