How Python implements reversed reverse

Source: Internet
Author: User

1 string and list implementations (methods using slices) do not modify the original contents of the element and assign the output to the value

In [the]: s= ' Nihao ' in []: S1 = s[::-1]in [[]: s1out[36]: ' Oahin '
In [lout[47]: [' C ', ' B ', ' A ']in []: l[::-1]out[48]: [' A ', ' B ', ' C ']


2 list and tuple unique methods

L.reverse ()


However, this method is seldom used, and the original content is modified without a return value

in [[]: lout[50]: [' C ', ' B ', ' A ']in [Wuyi]: L1 = L.reverse () in []: lout[52]: [' A ', ' B ', ' C ']in [+]: l1in [54]:


This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1766713

How Python implements reversed reverse

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.