Guest User

Untitled

a guest
May 26th, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.25 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import os
  5. import sys
  6. import commands
  7. from subprocess import call
  8.  
  9. call("clear")
  10.  
  11. print "Witaj  w edytorze tekstu,"
  12. print """Co chcialbys wykonac w "text.txt":
  13. 1 - Nazwa uzytkownika, data
  14. 2 - Stworz folder
  15. ///////////////////////3 - Stworz plik //niedziala
  16. 4 - Usun folder
  17. ///////////////////////////////////////5 - Usun plik
  18.  
  19. 6 - Cala zawartosc pliku
  20. 7 - Zawartosc tekstu od.. do..
  21. 8 - Ilosc danego wyrazu  
  22. //////////////////////////////9 - Pozycje danego wyrazu
  23. 10 - Ile jest roznych wyrazow
  24.  
  25.  
  26.  
  27. """
  28.  
  29. wybor = input("Podaj numer: ")
  30. if wybor == 1:
  31.         print "Nazwa uzytkownika to:", os.getlogin()
  32.         f = os.popen('date')
  33.         now = f.read()
  34.         print "Today is ", now
  35.  
  36. if wybor == 2:
  37.         print "Jak sie ma nazywac folder?"
  38.         nazwa = raw_input()
  39.         os.mkdir(nazwa)
  40.  
  41. if wybor == 3:#@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  42.         print "Jak sie ma nazywac plik?"
  43.         nazwa = raw_input()
  44.         os.makedirs("nazwa")
  45.  
  46. if wybor == 4:
  47.         print "Jaki skasowac folder?"
  48.         nazwa = raw_input()
  49.         os.rmdir(nazwa)
  50.  
  51. if wybor == 5:#@@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  52.         print "Jaki skasowac plik?"
  53.         nazwa = raw_input()
  54.         os.rm(nazwa)
  55.  
  56. f = open("text.txt", "rt")
  57. text = f.read()if wybor == 6:
  58.         print text
  59.  
  60. if wybor == 7:
  61.         print "Podaj dolny i gorny zakres:"
  62.         dolny = input("dolny:")
  63.         gorny = input("gorny:")
  64.         print "Text to: \n" , text[dolny:gorny]
  65.  
  66. if wybor == 8:
  67.         print "Podaj nazwe elementu"
  68.         nazwa = raw_input()
  69.         print "Ilosc fraz:" , nazwa, "to:",text.count(nazwa)
  70.  
  71. if wybor == 9:#@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  72.         for w, x in enumerate(text):
  73.           if x == "do":
  74.                 print w,
  75.  
  76. if wybor == 10:
  77.         print len(set(text))
  78.  
  79.  
  80. g = open("text.txt", "w") #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  81. g.write("Oto kilka początkowych liczb pierwszych:\n")
  82. for i in [2, 3, 5, 7, 11]:
  83.         g.write(str(i)+" ")
  84. g.close()
  85.  
  86. #if wybor == 11:
  87.  
  88.  
  89. #if wybor == 10:
Advertisement
Add Comment
Please, Sign In to add comment