我有一些代码可以工作。问题是,输出数字不合适。我查看了sorted()函数并相信这就是我需要使用的,但是当我使用它时,它说排序只能有4个参数,我有6-7个参数。排序函数需要4个参数?
print "Random numbers are: "
for _ in xrange(10):
print rn(),rn(), rn(), rn(), rn(), rn(), rn()
with open('Output.txt', 'w') as f:
f.write("Random numbers are: \n")
for _ in xrange(500):
f.write("%s,%s,%s,%s,%s,%s\n" % (rn(), rn(), rn(), rn(), rn(), rn()))
如何对输出进行排序,同时保持与此格式相同的格式?
谢谢
完美的工作。谢谢。 – BubbleMonster