-1

Hi, I'm brand new to Python and am completely clueless in this assignment. This is the 3rd assignment, but the first without hints on how to import, etc..

The objective of this assignment was to decode a file we are supposed to use the python hw.py < code.txt command with. This confused me right from the start, I understand that it uses the file as the input, but I dont understand how to do that code sided. We are also supposed to be shifting using letter frequencies, which are in percentages, also have not yet been discussed in class. Any help would be greatly appreciated. I have taken a look at the other vigenere ciphers, but they are way to complicated to my understanding.

Thanks a bunch!

3
Contributors
3
Replies
7
Views
7 Years
Discussion Span
Last Post by ov3rcl0ck
0

In order to read the contents of code.txt , you'll need to read the stdin pipe. To access it, use the sys.stdin handle, which you can read from just like an open file handle. You'll need to use the sys module, obviously.

The rest is just coding the cypher.

HTH

Edited by jlm699: n/a

0

In order to read the contents of code.txt , you'll need to read the stdin pipe. To access it, use the sys.stdin handle, which you can read from just like an open file handle. You'll need to use the sys module, obviously.

The rest is just coding the cypher.

HTH

alternatively you can just grab the file location as if it was an argument like so:

import sys
f=open(sys.arg[2],'r')

That should do it as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.