python学习(二十二) String(上)

 

 

str1 = "This is a 'test'"
print(str1)

str1 = 'This is a "test"'
print(str1)

str1 = "This is a \"test\""
print(str1)

str1 = 'This is a \'test\' '
print(str1)

str1 = "This is a single \
string"
print(str1)

'''
len()
lower()
upper()
str()
'''

print(len("abc"))
print("aAbc".lower())
print("abc".upper())
print("abc" +  str(2))
print("hello" + " " + "world")

result:

C:\Users\FeiLiu\AppData\Local\Programs\Python\Python36\python.exe C:/Users/FeiLiu/PycharmProjects/GetBluePageInfo/src/stringTest.py
This is a 'test'
This is a "test"
This is a "test"
This is a 'test' 
This is a single string
3
aabc
ABC
abc2
hello world

 

posted @ 2018-10-22 16:52  刘大飞  阅读(135)  评论(0编辑  收藏  举报