It's funny to me that, armed with English and German, I can read printed Dutch pretty well...but spoken Dutch might as well be Arabic to me!
Several things strike me about the code.
(1) All import statements should occur at the top of the main code, before functions are defined (there are rare exceptions to this practice, but that's the rule). So: move lines 13, 14, and 43 to the top, and eliminate line 2.
(2) Generally, I try to get the skeleton framework for the code working before I get the whole thing working. In your case, you want to (a) have the user guess a number, (b) keep track of all of the user scores in a round, and (c) store the user scores in a file.
Create your program in that order. Get a basic guess-the-number program working. Then create a program that gets the user's name and keeps track of his scores within the round. Then finally, add the file functionality.
(3) Your topscore dictionary appears to be like this: {"name1": score1, "name2": score2, ...}. I would recommend reversing that: {score1: "name1", score2: "name2", score3: "name3", ...}.
By doing so, you can sort the keys and take, say, the top ten, eliminating the rest.
Hope it helps,
Jeff
import random
secret = random.randint(1,100)
guesses = 0
while True:
guess = raw_input("I'm thinking of an integer between 1 and 100. What is it? ")
if guess == "quit":
break
try:
guess = int(guess)
except:
print "Please enter an integer!"
continue
guesses += 1
if guess > secret:
print "Too high!"
elif guess < secret:
print "Too low!"
else:
break
if guess == secret:
print "You got it! It took you %d tries." % guesses
else:
print "Sorry! Better luck next time!"
>>>
I'm thinking of an integer between 1 and 100. What is it? two
Please enter an integer!
I'm thinking of an integer between 1 and 100. What is it? 50
Too low!
I'm thinking of an integer between 1 and 100. What is it? 75
Too high!
I'm thinking of an integer between 1 and 100. What is it? 65
Too high!
I'm thinking of an integer between 1 and 100. What is it? 60
Too low!
I'm thinking of an integer between 1 and 100. What is it? 63
Too high!
I'm thinking of an integer between 1 and 100. What is it? 62
Too high!
I'm thinking of an integer between 1 and 100. What is it? 61
You got it! It took you 7 tries.
>>>