import csv
import time
with open("AuthorName.csv", "rb") as f:
reader = csv.reader(f, delimiter="\t")
for line in enumerate(reader):
time.sleep(2)
print line[1]
结果如下:
['rhaf_hq']
['Digixp']
['bujhoapp']
['styhuang']
['mkasanm']
如何在以下函数中调用这些列表: Screen_names
print json.dumps(get_user_profile(twitter_api, screen_names=["SocialWebMining"]), indent = 1 )
答案 0 :(得分:0)
这是一个示例函数,似乎可以满足您的要求。 它的工作原理如下:
import csv
def make(fileName):
with open(fileName) as file:
values = []
#Putting all your file's data in a list
for each in file:
each = each.strip()
values.append(each)
#Creating your new file
with open('newValues.csv','w') as newFile:
#creating a variable to write with
valueWriter = csv.writer(newFile)
#writing each individual value to your new file
for each in values:
valueWriter.writerow([each])