4
modifications
(JvCare Python : tabulations plus lisibles) |
(JvCare Python liste en compréhension) |
||
Ligne 176 : | Ligne 176 : | ||
def jvcare(classe: str) -> str: | def jvcare(classe: str) -> str: | ||
base16 = '0A12B34C56D78E9F' | base16 = '0A12B34C56D78E9F' | ||
s = classe.split()[1] | |||
url = <nowiki>''</nowiki> | url = <nowiki>''</nowiki> | ||
for i, j in zip(s[0::2], s[1::2]): | for i, j in zip(s[0::2], s[1::2]): | ||
url += chr(base16.index(i) * 16 + base16.index(j)) | url += chr(base16.index(i) * 16 + base16.index(j)) | ||
return url | return url | ||
====== Liste en compréhension ====== | |||
def jvcare(classe: str) -> str: | |||
base16 = '0A12B34C56D78E9F' | |||
s = classe.split()[1] | |||
return <nowiki>''</nowiki>.join([chr(base16.index(i) * 16 + base16.index(j)) for i, j in zip(s[0::2], s[1::2])]) | |||
==== C ==== | ==== C ==== |
modifications