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

Posted noobcong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了笨办法学Python3——习题6 字符串和文本相关的知识,希望对你有一定的参考价值。

【代码】

 

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 字符串和文本的主要内容,如果未能解决你的问题,请参考以下文章

笨办法学 Python (Learn Python The Hard Way)

笨办法学 Python(第三版)习题 14: 提示和传递

笨办法学 Python(第三版)习题 14: 提示和传递

笨办法学 Python(第三版)习题 3: 数字和数学计算

笨办法学 Python(第三版)习题 5: 更多的变量和打印

笨办法学 Python(第三版)习题 4: 变量(variable)和命名