Guest User

subwrite

a guest
Aug 10th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. #_*_coding: utf-8_*_
  2. print ("||#######################||")
  3. print ("||###### SubWrite #######||")
  4. print ("||#######################||")
  5. print ("Digite # e de enter para sair")
  6. print ("0) criar arquivo *.txt")
  7. print ("1) editar arquivo")
  8. opc = input("opção: ")
  9. if opc == "#":
  10.   exit()
  11. elif opc == "0":
  12.   local = input ("nome e local a ser salvo: ")
  13.   while 1:
  14.     sub = str(input(""))
  15.     if sub == "#":
  16.       exit()
  17.     else:
  18.       subw = open(local, "a")
  19.       subw.writelines(sub)
  20.       subw.write("\n")
  21.       subw.close()
  22. elif opc == "1":
  23.   sub = input("arquivo: ")
  24.   subw = open (sub, "r")
  25.   txt = subw.readlines()
  26.   for l in txt:
  27.     while 1:
  28.       fl = open(sub, "a")
  29.       edit = str(input(l))
  30.       if edit == "#":
  31.         fl.close()
  32.         subw.close()
  33.         exit()
  34.       else:
  35.         fl.writelines(edit)
  36.         fl.write("\n")
  37.         fl.close()
  38.         subw.close()
  39. else:
  40.   print ("command not found!")
Add Comment
Please, Sign In to add comment