Big Data with python? Speed moving
Enter 1e7 then suddenly came out of python Euler screen, tune for a long time
A solution after a few seconds,PY really rapidly
PY can never learned as a student to read the VB program, anyway, almost isolated language [fog
Code
import os
import ssl
import urllib
import time
import re
import urllib
def getPrime(n):
v=[0 for i in range(n+1)]
p=[]
for i in range(2,n):
if v[i]==0:
p.append(i)
# print(i)
for j in p:
if i*j>n:
break
v[i*j]=1
if i%j==0:
break
return p
while 1:
n=input()
try:
n=int(n)
except:
break
f=open('F:\\PY\\List.txt','w')
for i in getPrime(n):
f.write(str(i)+' ')
f.close()
So, the same principles, the same wording, PY why slow so good?