Python string manipulation

Source: Internet
Author: User

#coding =utf-8
#转义字符
#\n-Enter
#\ '-' No.
#\ "-Double quotes
#\t-Tab
#\\-\ Slash
Print ("Hello there!\nhow is you?\ni\ ' m doing fine. \n\ "My name is Wangyongke.\" ")
Print ("\ t hello,i\ ' m here.")
Print ("Hello,this is \ \.")


#原始字符串--Print all characters without escaping
Print (r "Hello There!\nhow is you!")
Print (r ' hello,\n \ \ \ \ "')


#三重引号 3 single or double quotation marks
#\\ are also escaped in Sanchong quotes.
Print ("'
Hello, there!.
How is it?
I ' m doing fine.
\\\\\\\\\\\\
''')
#三重引号作为多行注释如下
'''
eg
Print (' Hello ')
'''





#字符串下标和切片
str01= ' Wang Yongke '
Print (Str01[0:4])
Print (len (STR01))
J=0
For I in Str01:
Print (i,end= "")
Print (j,end= "")
J+=1


#字符in and not in operation
Print (' \ n ')
Print (' W ' in Str01)
Print (' GG ' not in Str01)



Python string manipulation

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.