Melissa M.
asked 09/15/19
how do you check if the starting value of a file is "S" if: content = file.read() first = content[0] last = content[-1]
Benjamin S.
answered 09/17/19
Bioinfomatics Lab Assistant for 3 years
Hi Melissa, it looks like you're just about there! You actually just need to check if your variable "first" is "S":
file = open("file_name.txt", "r")
content = file.read()
if content[0] == "S":
print("file begins with S")
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.