I always forget stuff, so I’ll start to post my snippet here.
Generate n length random string
1 2 3 4 5 6 | import random def random_string(n): """ Create n length random string """ code = ''.join([random.choice('abcdefghijklmnoprstuvwyxzABCDEFGHIJKLMNOPRSTUVWXYZ0123456789') for i in range(n)]) return code |
Related posts:
- Django Tutorial – Simple Notes Application
- PHP Tips and Tricks
- Handling 404 Page on FeinCMS
- Dynamic Module Loading in Python from a Directory
- Receiving Email Using AppEngine and Django
Tags: python
Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog.
Best regards Alex
This is just the type of detail I was hunting for. I wish I’d have found your web blog before.