You can simplifying your code as suggest på vegaseat.
Think about design,now you have one long main function.
This make code hard to read and if you want to add more code this will soon get difficult.
Split code upp in more function.
A shorter function is eaiser to test and read.
A function keep code local,so you can use in and other code if you need that later.
Just some code to show you what i mean.
import random
def read_in_file():
shuffle_txt = open("kn.txt", "r").readlines()
random.shuffle(shuffle_txt)
return shuffle_txt
def do_domething(arg):
'''This is a dok string you can explain what this function do'''
my_list = arg
print my_list #Just a test print to show how you can get data in from read_in_file()
def main():
while True:
print '(1)play Knock game'
print '(2) Quit'
choice = raw_input('Enter your choice: ')
if choice == '1':
shuffle_txt = read_in_file()
do_domething(shuffle_txt)
elif choice == '2':
return
else:
print 'Not a correct choice:', choice
if __name__ == "__main__":
main()