Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Update task0.py #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update task0.py #16

wants to merge 1 commit into from

Conversation

tianjun0
Copy link

@tianjun0 tianjun0 commented Jun 3, 2018

import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
incoming number, answering number, time = zip(*texts)
incoming number = incoming number[0]
answering number = answering number[0]
time = time[0]
print("First record of texts, {} texts {} at time {}".format(incoming number, answering number, time))

with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
incoming number, answering number, time, during = zip(*calls)
incoming number = incoming number[-1]
answering number = answering number[-1]
time = time[-1]
during = during[-1]
print("Last record of calls, {} calls {} at time {}, lasting {} seconds".format(incoming number, answering number, time, during number))

import csv
with open('texts.csv', 'r') as f:
    reader = csv.reader(f)
    texts = list(reader)
    incoming number, answering number, time = zip(*texts)
    incoming number = incoming number[0]
    answering number = answering number[0]
    time = time[0]
print("First record of texts, {} texts {} at time {}".format(incoming number, answering number, time))

with open('calls.csv', 'r') as f:
    reader = csv.reader(f)
    calls = list(reader)
    incoming number, answering number, time, during = zip(*calls)
    incoming number = incoming number[-1]
    answering number = answering number[-1]
    time = time[-1]
    during = during[-1]
print("Last record of calls, {} calls {} at time {}, lasting {} seconds".format(incoming number, answering number, time, during number))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant