Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91588

What use for reversed()?

Newsgroups comp.lang.python
Date 2015-05-31 12:40 -0700
Message-ID <514c05fc-dded-4278-ac86-3e8e3cd0e851@googlegroups.com> (permalink)
Subject What use for reversed()?
From fl <rxjwg98@gmail.com>

Show all headers | View raw


Hi,

I have a string b='1234'. I run: br=reversed(b)

I hope that I can print out '4321' by:

for br in b

but it complains:
SyntaxError: invalid syntax


My questions:
1. What use for reversed(). I do not find an example on web.

2. If reversed() is wrong the my purpose, what method can do it? i.e. '4321'
out.


Thanks,

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 12:40 -0700
  Re: What use for reversed()? Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-31 19:58 +0000
    Re: What use for reversed()? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-31 18:06 -0600
  Re: What use for reversed()? cheshire <supportNOSPAM@microsoft.com> - 2015-05-31 23:26 +0200
  Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 09:23 +1000
    Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 20:11 -0700
  Re: What use for reversed()? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-01 01:30 +0100
  Re: What use for reversed()? Tim Delaney <timothy.c.delaney@gmail.com> - 2015-06-01 13:59 +1000
  Re: What use for reversed()? fl <rxjwg98@gmail.com> - 2015-05-31 22:15 -0700
    Re: What use for reversed()? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-01 09:11 +0300

csiph-web