如何阻止程序添加文件中已经存在的对象?

def Add():
Name = input('Enter student name:')
f = open('Stu.txt', 'a')

我应该在这里添加什么以停止程序添加文件中存在的名称