age = 23
message = "Happy " + str(age) + "rd Birthday"
print(message)

输出位

Happy 23rd Birthday

Python自学:第二章 使用函数str( )避免类型错误的更多相关文章

  1. Python自学:第二章 Python之禅

    >>print import <Python之禅>,提姆·彼得斯著 美胜于丑. 显式优于隐式. 简单胜于复杂. 复杂总比复杂好. 平的比嵌套的好. 稀疏胜于稠密. 可读性计数. ...

  2. Python自学:第二章 注释

    #向大家问好 print("Hello Python People") 输出为 Hello Python People

  3. Python自学:第二章 删除空白

    lstrip:剔除开头空白 strip:剔除两段空白 rstrip:剔除末尾空白 favorite: 最喜欢的 >>>favorite_language = "Python ...

  4. Python自学:第二章 使用制表符或换行符来添加空白

    print("Languages:\n\tPython\n\tC\n\tJava") 输出为: Languages: Python C Java

  5. Python自学:第二章 动手试一试

    print(1 + 7) print(16 - 8) print(2 * 4) print(8 / 1) 输出为: 8 8 8 8.0 message = " print("I l ...

  6. Python自学:第二章 浮点数

    >>>0.1 + 0.1 0.2 >>>0.2 + 0.2 0.4 >>>2 * 0.1 0.2 >>>2 * 0.2 0.4

  7. Python自学:第二章 数字 整数

    >>>2 + 3 5 >>>3 - 2 1 >>>3 * 2 6 >>>3 / 2 1.5

  8. Python自学:第二章 合并(拼接字符串)

    first_name = "ada" last_name = "lovelace" full_name = first_name + " " ...

  9. Python自学:第二章 修改字符串的大小写 titile.()、upper()、lower()

    title.():首字母大写 upper():全大写 lower():全小写 ada lovelace:人名,传控计算机创始人 name = "ada lovelace" prin ...

随机推荐

  1. springboot+@async异步线程池的配置及应用

    示例: 1. 配置 @EnableAsync @Configuration public class TaskExecutorConfiguration { @Autowired private Ta ...

  2. python基础之 列表,元组,字典

    other help(str.strip) #查看是否有返回值以及返回值类型[] :称为索引操作符 1.列表 列表相比字符串来说能存储大量数据的python的基本数据类型,并且也拥有字符串的一些方法( ...

  3. (转)Docker容器的重启策略及docker run的--restart选项详解

    1. Docker容器的重启策略 Docker容器的重启策略是面向生产环境的一个启动策略,在开发过程中可以忽略该策略. Docker容器的重启都是由Docker守护进程完成的,因此与守护进程息息相关. ...

  4. 【Gradle】-NO.101.Gradle.1.gradle.1.001-【Gradle Configuration】-(

    Style:Gradle Series:Gradle Since:2018-09-20 End:2018-09-20 Total Hours:1 Degree Of Diffculty:5 Degre ...

  5. select默认选中

  6. [Python] Print input and output in table

    Print the input and output in a table using prettyTable. from prettytable import PrettyTable import ...

  7. python中使用os.path.join()

    os.path.join的详细解释请移步os.path模块在使用的过程中,我使用如下代码: import ospath = "F:/gts/gtsdate/"b = os.path ...

  8. python_WSGI接口

    WSGI:Web Server Gateway Interface WSGI接口定义非常简单,它只要求Web开发者实现一个函数,就可以响应HTTP请求.我们来看一个最简单的Web版本的“Hello, ...

  9. 转载一篇较为详细的caffe-ssd编译环境的搭建

    这篇搭建的文章写得还是比较全面的,亲测有效:https://blog.csdn.net/lukaslong/article/details/81390276

  10. linux iptables详解(转)

    概述 netfilter/iptables(简称为iptables)组成Linux平台下的包过滤防火墙,与大多数的Linux软件一样,这个包过滤防火墙是免费的,它可以代替昂贵的商业防火墙解决方案,完成 ...