๋ฐ์ํ
from difflib import SequenceMatcher
a_str = 'abcd'
b_str = 'bcd'
SequenceMatcher(None, a_str, b_str).ratio()
0.8571428571428571
match_rate = f'{SequenceMatcher(None, a_str, b_str).ratio()*100:.1f}%'
match_rate
'85.7%'
https://codetorial.net/tips_and_examples/difflib.html
๋ฐ์ํ
'Python > Basic' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] List - List ๋นผ๊ธฐ (0) | 2020.11.16 |
---|---|
[Python] psycopg2 ์ค์น ์ค๋ฅ (0) | 2020.11.11 |
[Python] ์์ธ ๋ฐ์ ์ํค๊ธฐ, ๋ฉ์ธ์ง ์ถ๋ ฅ (0) | 2020.10.22 |
[Python] cx_Oracle ํ๊ธ ๊นจ์ง (0) | 2020.10.20 |
[Oauth] Google, email ์ ๋ณด ์ป๊ธฐ (0) | 2020.10.09 |