擅长:python、mysql、java
<p>您的程序有两个问题:
1.nPrint丢失()。
2.即使输入()也只会打印0到某个范围的数字(取决于输入),然后输出时间</p>
<p>因此,我建议您采取以下措施:</p>
<p>删除nPrint()并使程序打印变量“i”:</p>
<p>def main():
导入时间
导入日期时间
随机导入</p>
<pre><code>def iRan():
for i in range(0,x):
xRan = print(i, datetime.datetime.now().strftime("%H:%M:%S"))
xRan
time.sleep(1)
x = int(input('How many times?'))
iRan()
xInp = input('Again?(y/n)')
if xInp == 'y':
main()
else:
exit()
</code></pre>
<p>主()</p>