вівторок, 21 грудня 2021 р.

Олімпіада робота з файлами Пітон (нотатки)



 

f=open('input.txt','r')

f2=open('output.txt','w')

a, b, c = (int(i.strip()) for i in f) # удаление пробелов

print (a,' ',b,' ',c)

print (type(a))

d=a+b+c

f.close ()

d=str(d)

f2.write(d + ' '+ d + '\n')

f2.write('\n')

f2.write (d)

f2.close()

f.close()

f=open('input.txt','r')

a, b, c = (int(i) for i in f.read().split())#разбиение на строки по пробелам

print (a,b,c)

f.close()

f=open('input.txt','r')

a=[]

for i in f:

    a.append(i.strip()) # удаление пробелов

print (a)

f.close()


Немає коментарів:

Дописати коментар