SHARE
TWEET

Untitled

a guest Nov 15th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '''
  2. f = open("dane.txt","w")
  3.  
  4. print(f)
  5. print("Otwieram plik: ", f.name, "w trybie: ", f.mode)
  6.  
  7. f.close()
  8.  
  9. try:
  10.     g = open("test.txt", "rb")
  11.     print(g)
  12. except IOError:
  13.     print ("Nie mogę otworzyć tego pliku")
  14.  
  15. h = open("dane.txt","r")
  16.  
  17. h.write("kawecki")
  18.  
  19. h.close()
  20.  
  21. print(h.read())
  22.  
  23. d = open("dane.txt","a")
  24.  
  25. d.write("xd")
  26.  
  27. d.close()
  28.  
  29. d = open("dane.txt","r")
  30.  
  31. print(d.read())
  32.  
  33. h = open("dane.txt","r")
  34.  
  35. for dane in h:
  36.     print(dane)
  37.  
  38. a=b=c=10
  39.  
  40. print(a, end=' ')
  41. print (b, end=' ')
  42. print(c)
  43.  
  44. print(a,b,c, sep=',')
  45.  
  46. h = open("dane.txt","r")
  47.  
  48. for dane in h:
  49.     print(dane, end='')
  50.  
  51. for dane in h:
  52.     print(dane.strip())
  53.  
  54. for dane in h:
  55.     print(dane.split())
  56. '''
  57.  
  58. from random import randint
  59.  
  60. plik = open("dziennik.txt","w")
  61.  
  62. for i in range(310):
  63.     plik.write(str(randint(400,600))+'\n')
  64.  
  65. plik.close()
  66.  
  67. plik = open("dziennik.txt","r")
  68.  
  69. wynik=[]
  70.  
  71. for i in plik:
  72.     wynik.append(int(i))
  73.  
  74. for i in range(len(wynik)):
  75.     print(wynik[i])
  76.  
  77. plik.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top