Programming Help

[SSA]HellSpawn

Veteran XV
In my cs one class we are leaning python, and i have to retrieve a text file and then encode it. After encoding the message we have to use the offset of the first letter to adjust the rest of the letters by that offset.

Right now all i'm trying to get to work is encoding the message into numbers.
So far this is what I have, I know i have to use the 'ord' function but im confused on how to get it do each line seperately.
This gets it to print each line of the file as well as putting it into all caps.
Code:
import string
def main():

    fname=raw_input("What is the file name?")
#asks for which file to open
    infile=open(fname, 'r')
    
#opens file
    for line in infile:
        line=string.upper(line)
        line=string.lstrip(line)
        line=string.rstrip(line)
        print line  
        
main()
 
Back
Top