Just a little project I had to code for my Python class. You input the text and a distance value (for the cipher) and it encrypts the text and creates a .txt file on your desktop with the encrypted text. It also opens that .txt file and copies the encryption into another newly created .txt file.

Code:
plainMessage = input('Enter a message: ') #user inputs text
distance = int(input('Enter the distance value: ')) #user inputs distance value
encryptText = ''
for ch in plainMessage: #caesar cipher formula
    ordValue = ord(ch)
    cipherValue = ordValue + distance
    encryptText += chr(cipherValue)
file = open('encrypt.txt', 'w') #cipher text to .txt file
file.write(encryptText) 
file.close()

with open('encrypt.txt') as file: #.txt file read/copied to another .txt file
    copyText = file.read()
    file = open('copyfile.txt', 'w')
    file.write(copyText)
    file.close()
Coded this in IDLE and to anyone learning Python I recommend being OCD about syntax and how you format your code (either single quotes all throughout not mixed, indentation, proper variable naming format, etc)