Putting #'s and variables together in 1 variable

Lamonte Harris pyth0nc0d3r at gmail.com
Thu Aug 23 16:09:15 EDT 2007


  File "Desktop\python\newsystem\init.py", line 51, in random_n
    random_name = a+b+c+d+e+ 'temp.txt'
TypeError: unsupported operand type(s) for +: 'int' and 'str'

import random
def random_name():
    a = random.randint(0,9)
    b = random.randint(0,9)
    c = random.randint(0,9)
    d = random.randint(0,9)
    e = random.randint(0,9)
    random_name = a+b+c+d+e+ 'temp.txt'
    return random_name
print random_name

How can i make it so that it adds the random numbers and the temp.txt to
random_name variable w/out causing any error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070823/70dc72da/attachment.html>


More information about the Python-list mailing list