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

笨办法学Python3——习题6 字符串和文本

时间:2018-11-03 20:18:23      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:nbsp   code   orm   字符串   HERE   who   hose   The   eva   

【代码】

 

types_of_people = 10
x = f"There are {types_of_people} types of people."

binary = "binary"
do_not = "dont‘t"
y = f"Those who know {binary} and those who {do_not}."

print(x)
print(y)

print(f"I said: {x}")
print(f"I also said: ‘{x}‘")

hilarious = "False"
joke_evalution = "Isn‘t that joke so funny?!{}"

print(joke_evalution.format(hilarious))

w = "This is the left side of…"
e = "a string with a right side."

print(w+e)

 

【输出结果】

There are 10 types of people.
Those who know binary and those who dont‘t.
I said: There are 10 types of people.
I also said: ‘There are 10 types of people.‘
Isn‘t that joke so funny?!False
This is the left side of…a string with a right side.

 

笨办法学Python3——习题6 字符串和文本

标签:nbsp   code   orm   字符串   HERE   who   hose   The   eva   

原文地址:https://www.cnblogs.com/noobcong/p/9901802.html

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