Calvin (Deutschbein)
W9Fri: 25 Oct
f = open("demofile3.txt", "w")
f.write("Woops! I have deleted the content!")
f.close()
#open and read the file after the overwriting:
f = open("demofile3.txt", "r")
print(f.read())
>>> f = open("demofile3.txt", "w")
>>> f.write("Woops! I have deleted the content!")
34
>>> f.close()
>>>
>>> #open and read the file after the overwriting:
>>> f = open("demofile3.txt", "r")
>>> print(f.read())
Woops! I have deleted the content!
>>>
f = open("cat.txt", "w")
for row in pixels[::10]:
# was 20, now 10
row_list = [pixel_to_letter(pixel) for pixel in row[::20]]
s = "".join(row_list)
f.write(s)
f = open("cat.txt", "w")
for row in pixels[::20]:
row_list = [pixel_to_letter(pixel) for pixel in row[::10]]
s = "".join(row_list)
f.write(s + '\n') # adding an "enter"
>>> f = open("cat.txt","r")
>>> f
<_io.TextIOWrapper name='cat.txt' mode='r' encoding='cp1252'>
>>> type(f)
<class '_io.TextIOWrapper'>
>>> s = f.read()
>>> type(s)
<class 'str'>
>>> s
f = open(filename,mode)
f = open(filename,"w")
f.write(some_text)
f = open(filename,"r")
some_text = f.read()
filename = choose_input_file()
s = open(filename).read()
|
|
def add_button(label, action):