Get Academic Help Instantly!

https://bestqualitywriters.com/please-use-python-my-current-codes-are-import-datetime-import-os-path-def-send_messagesender/

Please use python.

My current codes are:

import datetime
import os.path

def send_message(sender, recipient, message):
d = datetime.datetime.now()
# change the format of the time to what we want
new_datetime = str(d)[:-7].replace(“-“, “/”)
new_message = sender + “|” + new_datetime + “|” + message +
“n”

if os.path.isfile(“messages/” + recipient + “.txt”):
fp = open(“messages/” + recipient + “.txt”, “a”)
data = fp.write(new_message)
else:
fp = open(“messages/” + recipient + “.txt”, “w+”)
welcome = fp.write(“Welcome to your account!” + “n”)
data = fp.write(new_message)

fp.close()

# TESTER CODE
send_message(‘pikachu’, ‘charmander’, ‘Hey there!’)
send_message(‘charmander’, ‘pikachu’, ‘Good to see you!’)
send_message(‘pikachu’, ‘charmander’, ‘You too, ttyl’)

There will be two files created: pikachu.txt and
charmander.txt

What I need to do is to create another function that prints all
messages sent to the username in question.

The output should be something like:

In the file named ‘charmander.txt’:

pikachu|11/14/2020 13:37:15|Hey there!
pikachu|11/14/2020 13:37:15|You too, ttyl

Messages should be generated like this:

Message #1 received from pikachu
Time: 11/14/2020 13:37:15
Hey there!
Message #2 received from pikachu
Time: 11/14/2020 13:37:15
You too, ttyl

Please do not use the split function.

Thank you!

Solved!:

10% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET10 to claim 10% Discount This Month!!

Why US?

100% Confidentiality
100% Timely Delivery
100% Original Writing

100% Money Back

Cheap Essay Writing

Do my Assignment

Order custom essay

Sample Essays

Custom term paper

Write My Research Paper

Affiliate program

Custom essay

Research paper

Write my essay

Write my paper

Essay writers

Become a Freelance Writer

Contact us

Glossary

Sitemap

Terms and conditions

Privacy policy

Proficient Concepts  is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.