Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This program deletes unwanted indenters in a text file.
- #To use that program, put the text you want to de-indent into a .txt file.
- #Then run the program.
- filename = input("Enter text file name: ")
- if filename [-4:] != ".txt":
- filename += ".txt"
- outputfilename = input("Enter output file name: ") + (".txt")
- if filename [-4:] != ".txt":
- outputfilename += ".txt"
- chrcount = int(input("Enter how many characters/spaces do you want to delete: "))
- with open(filename) as textfile:
- paragraph = list(textfile)
- i = 0
- for line in paragraph:
- paragraph[i] = line[chrcount:]
- i+=1
- paragraph = "".join(paragraph)
- f = open(outputfilename,'w')
- f.write(paragraph)
- f.close()
- print("\n" + outputfilename, "has succesfully created.\n")
- input("Press enter to continue...")
Add Comment
Please, Sign In to add comment