给自己写的函数添加注释,并在调用自动补全时可以显示提示:
在函数定义下面使用'''
进行注释
def read_json_file(file_name):
'''
从tweets中提取ID,并组成集合返回
'''
with open(file_name, "r", errors="ignore") as f:
tweet_id_set = set()
for line in f:
json_obj = json.loads(line.strip())
tweetid = json_obj["tweetId"]
tweet_id_set.add(tweetid)
return tweet_id_set