问题描述:

This is my code

import time

import attacker

import random

"You sumble of the path and are confronted with "

attaker=random,randint(0,5)

if attacker==1:

print" Gandalf"

if attaker==2:

print" Harry Potter"

if attaker==3:

print" a Smurf"

if attaker==4:

print" a wierd dude with a sword "

if attaker==5:

print" a Giant Spider"

The Syntax error is "Traceback (most recent call last):

File "C:\Users\Nathan\Documents\V1", line 3, in

import attacker

ImportError: No module named attacker"

网友答案:

import attacker at the top assumes there's a module attacker.py or attacker.pyc . Since you use attacker to store a number, I'm guessing there is no module. Hence the error.

Also attaker=random,randint(0,5) should be attaker=random.randint(0,5). The dot is how you invoke module's variables or functions.

相关阅读:
Top