Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python3 Trying to get the code so it: 1 - pulls timestamps from the file 2 - pulls those one at a time and each

python3
Trying to get the code so it:
1 - pulls timestamps from the file
2 - pulls those one at a time and each time another one
Problems:
This is what I get from my current code:
1 - it does not actually pull timestamps
2 - every time I run it it gives me the same output
3 - maybe I can alter Problem 2 by calling the program or using next() somehow?
image text in transcribed
This is the back-end as is.
image text in transcribed
Previous version of the same.
image text in transcribed
But this one yields all at once.
image text in transcribed
Complete solution please.
This is a Python generator/yield problem in case you missed it. Meaning the advantage is to pull from a large file faster.
Ty!
Ivkorolorenills -]} nano VRHW3v1.py [vkorolof@hills - ]$ python3 VKHW3v1.py first [vkorolofhills -]$ python3 VKHW3v1.py first?.. [vkorolof@hills -]$ python3 VKHW3v1.py first [vkorolof@hills ~]$ python3 VKHW3v1.py first Sivkorolof@hills -]$ python3 VKHW307.py first ''[vkorolof@hills -]$ Lenovo 'import datetime f = open('/etc/httpd/logs/access_log', 'T') def gen() : n=1 print('first') yield next n+=1 print('second') yield next n+=1 print('third') yield next . a = gen() next(a) import datetime f = open('/etc/httpd/logs/access_log', 'I def gen() : n=1 print('first's yield next n+=1 print('second') yield next n+=1 print('third') yield next a = gen() .. next(a) next(a) next(a) NG Get Help AX Exit O Writeout Justify [vkorolof@hills -]$ python3 VKHW3v1.py. first second third '[vkorolof@hills

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

3. What should a contract of employment contain?

Answered: 1 week ago

Question

1. What does the term employment relationship mean?

Answered: 1 week ago