Skip to content

Instantly share code, notes, and snippets.

@st98
Last active December 28, 2015 18:39
Show Gist options
  • Save st98/7544915 to your computer and use it in GitHub Desktop.
Save st98/7544915 to your computer and use it in GitHub Desktop.
変数名を生成する関数。英小文字オンリーです。
from random import randint
def gen_variable_name(a):
while True:
yield ''.join([
chr(0x61 + randint(0, 25))
for _ in range(a)
])
if __name__ == '__main__':
a = gen_variable_name(int(input()))
for _ in range(10):
print(next(a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment