[PYTHON] Arrange the prepared characters at random

Yes. I think I often saw it around last weekend. Randomly arrange from the prepared ones ~ ~ ~ ~

kawaii.py


#!/usr/bin/python
# -*- coding: utf-8 -*-

import random
import os,sys
import cgitb; cgitb.enable()

#Random character string to prepare
material=[u'Or', u'Wow', u'I', u'I', u'ゎ', u'I', u'KA']
#Collision detection string
match=u'cute'
#Random generation
s=u''.join([material[random.randint(0,6)] for i in xrange(758)])
#search
hit=s.find(match)
#Judgment
if hit < 0:
    no=u'I couldn't make cute. It seems that women's power is not enough.'
else:
    no=s[:hit + len(match)]+ u'\n\n'+str(hit+len(match))+ u'I made a cute one in the second time.'

#Display the result in the browser
print 'Content-Type: text/pain;charset=utf-8'
print

print 
print 
print 'Can you make cute? ??'
print '\n\n\n'
print no.encode('utf-8')

Recommended Posts

Arrange the prepared characters at random
Try disabling IPv6 at random