Skip to content

Instantly share code, notes, and snippets.

@paramire
Last active June 20, 2022 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paramire/79cccc53bf2e823fb9665156dc37ce98 to your computer and use it in GitHub Desktop.
Save paramire/79cccc53bf2e823fb9665156dc37ce98 to your computer and use it in GitHub Desktop.
longText - Issue 252
# -*- coding: utf-8 -*-
import sys
import unicodedata
def is_vowel(char):
_char = unicodedata.normalize('NFKD', char)
if _char[0].lower() in 'aeiou':
return True
return False
def longText(word, expand):
if sys.version_info[0] < 3:
word = word.decode('utf8')
char_list = [
c * expand if is_vowel(c) else c
for c in word
]
return ''.join(char_list)
if __name__ == "__main__":
print(longText('hello world', 3))
print(longText('lol', 10))
print(longText('Árbol', 5)) # spanish
print(longText('Füße', 7)) # deutch
print(longText('mākonis', 3)) # latvia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment