print "This program converts a sequence of ASCII numbers into" print "the string of text that it represents." print
# get the message to encode
instring = raw_input("Please enter the ASCII-encoded messages: ") #loop through each substring and build ASCII message
message = "" for numStr in string.split(inString): asciinum = eval(numstr) # convert digits to a number message = message + chr(asciinum) # append character to message print "The decoded message is: ", message
> print "This program converts a sequence of ASCII numbers into"
> print "the string of text that it represents."
> print
> # get the message to encode
> instring = raw_input("Please enter the ASCII-encoded messages: ")
> #loop through each substring and build ASCII message
> message = ""
> for numStr in string.split(inString):
> asciinum = eval(numstr) # convert digits to a number
> message = message + chr(asciinum) # append character to message
> print "The decoded message is: ", message
> main()
> -- > You received this message because you are subscribed to the Google Groups "PyScripter" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/pyscripter/-/MnWtFuyvBeIJ.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyscripter?hl=en.
On Sun, Oct 28, 2012 at 10:29 PM, Andy Milne <gspi...@gmail.com> wrote:
> Replace:
> string.split
> With:
> instring.split
> On Oct 28, 2012, at 5:04 PM, Randy Armstrong <affinit...@gmail.com> wrote:
> def main():
> print "This program converts a sequence of ASCII numbers into"
> print "the string of text that it represents."
> print
> # get the message to encode
> instring = raw_input("Please enter the ASCII-encoded messages: ")
> #loop through each substring and build ASCII message
> message = ""
> for numStr in string.split(inString):
> asciinum = eval(numstr) # convert digits to a number
> message = message + chr(asciinum) # append character to message
> print "The decoded message is: ", message
> main()
> --
> You received this message because you are subscribed to the Google Groups
> "PyScripter" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyscripter/-/MnWtFuyvBeIJ.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to
> pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyscripter?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "PyScripter" group.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to
> pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyscripter?hl=en.
> On Sun, Oct 28, 2012 at 10:29 PM, Andy Milne <gspi...@gmail.com> wrote:
>> Replace:
>>> string.split
>> With:
>>> instring.split
>> On Oct 28, 2012, at 5:04 PM, Randy Armstrong <affinit...@gmail.com> wrote:
>>> def main():
>>> print "This program converts a sequence of ASCII numbers into"
>>> print "the string of text that it represents."
>>> print
>>> # get the message to encode
>>> instring = raw_input("Please enter the ASCII-encoded messages: ")
>>> #loop through each substring and build ASCII message
>>> message = ""
>>> for numStr in string.split(inString):
>>> asciinum = eval(numstr) # convert digits to a number
>>> message = message + chr(asciinum) # append character to message
>>> print "The decoded message is: ", message
>>> main()
>>> -- >>> You received this message because you are subscribed to the Google Groups "PyScripter" group.
>>> To view this discussion on the web visit https://groups.google.com/d/msg/pyscripter/-/MnWtFuyvBeIJ.
>>> To post to this group, send email to pyscripter@googlegroups.com.
>>> To unsubscribe from this group, send email to pyscripter+unsubscribe@googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/group/pyscripter?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups "PyScripter" group.
>> To post to this group, send email to pyscripter@googlegroups.com.
>> To unsubscribe from this group, send email to pyscripter+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/pyscripter?hl=en.
> -- > You received this message because you are subscribed to the Google Groups "PyScripter" group.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyscripter?hl=en.
got these programs out of book python programming introduction to computer
science 2004 which could be my problem. The first program: text2numbers.py
works fine but it's sister program- numbers2text.py take the numbers and
turns them back into legible text. and ive done it exactly as the book
shows so thats why im puzzled and thinking its just out of date code. Im in
my first year with this so if that gives you an indication as to where im
at here.Thanks for helping Im just glad someone replied!
On Sun, Oct 28, 2012 at 11:54 PM, Andy Milne <gspi...@gmail.com> wrote:
> Fixed the error, but doesn't run as you expect?
> What delimiter are you expecting in the input?
> Whatever the delimiter is, pass it as the parameter to split.
> On Oct 28, 2012, at 7:46 PM, Randy Armstrong <affinit...@gmail.com> wrote:
> not working, are you able to get it to work?
> On Sun, Oct 28, 2012 at 10:29 PM, Andy Milne <gspi...@gmail.com> wrote:
>> Replace:
>> string.split
>> With:
>> instring.split
>> On Oct 28, 2012, at 5:04 PM, Randy Armstrong <affinit...@gmail.com>
>> wrote:
>> def main():
>> print "This program converts a sequence of ASCII numbers into"
>> print "the string of text that it represents."
>> print
>> # get the message to encode
>> instring = raw_input("Please enter the ASCII-encoded messages: ")
>> #loop through each substring and build ASCII message
>> message = ""
>> for numStr in string.split(inString):
>> asciinum = eval(numstr) # convert digits to a number
>> message = message + chr(asciinum) # append character to message
>> print "The decoded message is: ", message
>> main()
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PyScripter" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/pyscripter/-/MnWtFuyvBeIJ.
>> To post to this group, send email to pyscripter@googlegroups.com.
>> To unsubscribe from this group, send email to
>> pyscripter+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/pyscripter?hl=en.
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PyScripter" group.
>> To post to this group, send email to pyscripter@googlegroups.com.
>> To unsubscribe from this group, send email to
>> pyscripter+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/pyscripter?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "PyScripter" group.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to
> pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyscripter?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "PyScripter" group.
> To post to this group, send email to pyscripter@googlegroups.com.
> To unsubscribe from this group, send email to
> pyscripter+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyscripter?hl=en.