我有一个生成 10 行的脚本,每行都在单独的行上。我希望它生成 10 列,而不是行。
import csv
import os
import random
for dirname, dirnames, filenames in os.walk(r"C:/Users/s/Desktop/filme/"):
for subdirname in dirnames:
foldere_filme = os.path.join(dirname, subdirname)
numarul_folderelor = foldere_filme.replace("C:/Users/s/Desktop/filme/", "")
print numarul_folderelor #1,2,3,4,5...
root_text = "C:/Users/s/Desktop/text/tags"+numarul_folderelor+".csv"
fisier_text_tags = csv.writer(open(root_text,'wb'))
for filenames in os.listdir(foldere_filme):
tags = filenames.replace("<SP>", " ").replace(".avi", "")
test = ['blah '+varible+' test, blah '+varible+' aaaaah clip, blah '+varible+' putlocker, download '+varible+' clip',
'blah '+varible+' free tuttiing, blah '+varible+' clip free, blah '+varible+' test clip, download '+varible+' aaaaah clip',
'blah '+varible+' 2012, blah '+varible+' test free, download '+varible+' 2012 clip, free tuttiing '+varible+'',
'blah '+varible+' free aaaaah clip, blah '+varible+' test 2012, where to blah '+varible+', '+varible+' aaaaah clip test',
'strem '+varible+' test free, blah '+varible+' free 2012, blah '+varible+' test for free, '+varible+' aaaaah clip test',
'putlocker 2012, blah '+varible+' free, download '+varible+' test, blah test '+varible+' for free, free clip tuttiing']
random.shuffle(test)
fisier_text_tags.writerow(test[0:1])