Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os
- import sys
- import commands
- from subprocess import call
- call("clear")
- print "Witaj w edytorze tekstu,"
- print """Co chcialbys wykonac w "text.txt":
- 1 - Nazwa uzytkownika, data
- 2 - Stworz folder
- ///////////////////////3 - Stworz plik //niedziala
- 4 - Usun folder
- ///////////////////////////////////////5 - Usun plik
- 6 - Cala zawartosc pliku
- 7 - Zawartosc tekstu od.. do..
- 8 - Ilosc danego wyrazu
- //////////////////////////////9 - Pozycje danego wyrazu
- 10 - Ile jest roznych wyrazow
- """
- wybor = input("Podaj numer: ")
- if wybor == 1:
- print "Nazwa uzytkownika to:", os.getlogin()
- f = os.popen('date')
- now = f.read()
- print "Today is ", now
- if wybor == 2:
- print "Jak sie ma nazywac folder?"
- nazwa = raw_input()
- os.mkdir(nazwa)
- if wybor == 3:#@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- print "Jak sie ma nazywac plik?"
- nazwa = raw_input()
- os.makedirs("nazwa")
- if wybor == 4:
- print "Jaki skasowac folder?"
- nazwa = raw_input()
- os.rmdir(nazwa)
- if wybor == 5:#@@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- print "Jaki skasowac plik?"
- nazwa = raw_input()
- os.rm(nazwa)
- f = open("text.txt", "rt")
- text = f.read()if wybor == 6:
- print text
- if wybor == 7:
- print "Podaj dolny i gorny zakres:"
- dolny = input("dolny:")
- gorny = input("gorny:")
- print "Text to: \n" , text[dolny:gorny]
- if wybor == 8:
- print "Podaj nazwe elementu"
- nazwa = raw_input()
- print "Ilosc fraz:" , nazwa, "to:",text.count(nazwa)
- if wybor == 9:#@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- for w, x in enumerate(text):
- if x == "do":
- print w,
- if wybor == 10:
- print len(set(text))
- g = open("text.txt", "w") #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- g.write("Oto kilka początkowych liczb pierwszych:\n")
- for i in [2, 3, 5, 7, 11]:
- g.write(str(i)+" ")
- g.close()
- #if wybor == 11:
- #if wybor == 10:
Advertisement
Add Comment
Please, Sign In to add comment