Jordan
Jordan

Reputation: 21

from time import timestart_time = time() , outputs syntax error

from time, importing time_start = time () gives me a syntax error.

i tried just importing start_time () assuming that 'time' is just part of the standard library.

from time import timestart_time = time() 

from random import randint 

requests = 0

for _ in range(5):
      requests += 1 
      sleep(radiant(1,3))
      elapsed_time = time() - start_time 
      print ('request: {}; Frequency: {} requests/s'.format(requests, requests/elapsed_time))

Ii expect the library to import with no error, i am probably over thinking the issue, thank you.

Upvotes: 1

Views: 1038

Answers (1)

Djaouad
Djaouad

Reputation: 22776

It's:

from time import time
start_time = time()

Add a newline after the import statement, or worse, a semicolon:

from time import time;start_time = time()

Upvotes: 3

Related Questions