码迷,mamicode.com
首页 > 编程语言 > 详细

python学习(二十二) String

时间:2018-10-22 17:58:47      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:exe   use   cts   char   upper   local   arm   python   cal   

 

 

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

 

python学习(二十二) String

标签:exe   use   cts   char   upper   local   arm   python   cal   

原文地址:https://www.cnblogs.com/liufei1983/p/9831048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!