split
and
join
What does the following print?
print("_".join("88r4if4r462".split("r4")))
Suppose the file rick.txt
contains:
Never gonna give you up
What is the output of the following code?
print(open("rick.txt", "r").read(5).split("e"))
Assume a file called fin.txt
exists in the same
directory as the program below, and has the following contents:
Start: 4pm
End: 7pm
3h
What does the following program print?
= open("fin.txt", 'r')
fin = open("fot.txt", 'w')
fot
for line in fin:
= line.strip().split(': ')
fl
-1])
fot.write(fl[0])
fot.write(fl[
fot.close()
fin.close()
= open("fot.txt", 'r')
fot = fot.read(3)
a 8)
fot.seek(print(a, fot.read())
fot.close()