Multiline f-strings
多行字符串使用fstring需要注意每行都要加fstring
>>> name = "Eric"
>>> profession = "comedian"
>>> affiliation = "Monty Python"
>>> message = (
... f"Hi {name}. "
... f"You are a {profession}. "
... f"You were in {affiliation}."
... )
>>> message
'Hi Eric. You are a comedian. You were in Monty Python.'
如果使用三个双引号
>>> message = f"""
... Hi {name}.
... You are a {profession}.
... You were in {affiliation}.
... """
...
>>> message
'\n Hi Eric.\n You are a comedian.\n You were in Monty Python.\n'
Multiline f-strings的更多相关文章
- RMQ 字符串 F. Strings and Queries
F. Strings and Queries time limit per test 2.5 s memory limit per test 256 MB input standard input o ...
- python 3和python 2 的不同之 f - strings
python3.6版本及以上版本才能使用 f "{}{}{}" f-string 格式化输出
- Go package: strings
Go strings Go 的 strings 包中包含许多处理字符串的函数 官方文档:https://golang.org/pkg/strings/ 前缀.后缀 判断字符串前缀.后缀 // 判断字符 ...
- OpenStack 的单元测试
目录 文章目录 目录 前言 单元测试能提高生产率 Python 单元测试工具清单 unittest Test Discover Test Fixture Test Suite Assert(断言) m ...
- 专题8:javascript函数详解
函数是一段可以反复调用的代码块.函数还能接受输入的参数,不同的参数会返回不同的值. 函数的声明 JavaScript 有三种声明函数的方法. (1)function 命令 function命令声明的代 ...
- 10 Go 1.10 Release Notes
Go 1.10 Release Notes Introduction to Go 1.10 Changes to the language Ports Tools Default GOROOT &am ...
- js 函数讲解
函数 来自<JavaScript 标准参考教程(alpha)>,by 阮一峰 目录 概述 函数的声明 函数的重复声明 圆括号运算符,return 语句和递归 第一等公民 函数名的提升 不能 ...
- LZSS.C
/************************************************************** LZSS.C -- A Data Compression Program ...
- nmcli 使用记录---fatt
安装nmcli工具 yum install NetworkManager 使用语法 Usage: nmcli [OPTIONS] OBJECT { COMMAND | help } OBJECT g[ ...
- file类简单操作
file类可表示文件或文件夹 import java.io.File; import java.io.FilenameFilter; import java.io.IOException; impor ...
随机推荐
- MVC方式使用EasyUI - 搭建环境
_Layout.cshtml <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Typ ...
- 内涵段子——脑筋急转弯——spider
# python 3.7 from urllib.request import Request,urlopen import re,time class Neihan(object): def __i ...
- c#系统预定义类型
- DNS理解
前言 英译汉的时候会掩盖很多本质,导致很多问题稀里糊涂,问的人不知道怎么说,回答的人也是答非所问. DNS是Domain Name System缩写,不是Domain Name Server,或者Do ...
- Const *ptr ptr
1. const int *ptr = NULL; <=> int const *ptr = NULL; 1) 表示指向符号常量的指针变量,指针变量本身并非const所以可以指向其他变量. ...
- PAT Advanced 1022 Digital Library (30 分)
A Digital Library contains millions of books, stored according to their titles, authors, key words o ...
- tp5 左连接
db('detainform')->alias('d')->join("information i",'i.z_id=d.z_id','LEFT')->where ...
- Android-File读写+SharedPreferences的存取地址
写了两个demo,一个是使用SharedPreferences将数据存储在应用文件中并读取,另一个是使用Context的openFileOutput和openFileInput将数据存储在应用文件中并 ...
- rabbitmq 持久化 事务 发送确认模式
部分内容来自:http://blog.csdn.net/hzw19920329/article/details/54315940 http://blog.csdn.net/hzw19920329/ar ...
- vue slot及用法,$slots访问具名slot