博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
变量和数据类型 .py
阅读量:6759 次
发布时间:2019-06-26

本文共 1808 字,大约阅读时间需要 6 分钟。

name = "ada lovelace" #单词首字母大写print(name.title())name = "Ada Lovelace" #全部大写,全部小写print(name.upper())print(name.lower())first_name = "ada"    #字符串的拼接last_name = "lovelace"full_name = first_name  + " " +  last_nameprint(full_name)print("python")        print("\tpython")     #制表符print("Language:\npython\nC\nJavaScrite")#换行符print("Language:\n\tpython\n\tC\n\tJavaScrite")favourite_language = ' python '          #删除空白print(favourite_language.lstrip ())print(favourite_language.rstrip ())print(favourite_language.strip ())message = "One of Python's strengths is its community" #引号应用print(message)my_name = 'zhangsan'                     #信息的输入my_age = 26my_height = 175my_weight = 74my_eyes = 'blue'my_teeth = 'white'my_hair = 'black'print("Let's talk about %s."% my_name)print("He's %d inches tall."%my_height)print("He's %d pounds heavy."%my_weight)print("He's %s"%my_age)print("Actually that's not too heavy.")print("He's got %s eyes and %s hair."%(my_eyes,my_hair))print("his teeth are usually %sdepending on the coffee."%my_teeth)print("if I add %d,%d,and %d Iget %d."%(my_age,my_height,my_weight,my_age+my_height+my_weight))name = ' Eric'  #字符串拼接print( 'hello'+ name+ "would you like to learn some Python today")print("Hello %s  would you like to learn some Python today "%name  )famous_sayings = 'Albert Einstein once said,"A person who never made a mistake never tried anything new"'famous_person = 'Albert Einstein'message = famous_person +  'once said,"A person who never made a mistake never tried anything new"'print(message)age = 23              #整数作为字符串message = ("Happy" + str(age) + "rd Birthday")print(message)age = '23'message = ("Happy" + age+ "rd Birthday")print(message)print(2+2)          #数字的基本运算print(2-2)print(2**2)print(2/2)

 

转载于:https://www.cnblogs.com/dws-love-jfl-1314/p/5860787.html

你可能感兴趣的文章
Linux定时器工具-crontab 各參数具体解释及怎样查看日志记录
查看>>
STM32_杂_01_串口代码
查看>>
v4l2驱动文档之——streaming IO【转】
查看>>
Hadoop问题记录:Wrong FS: hdfs://hp5-249:9000/, expected: file:///
查看>>
mfc 链接 access 2007 数据库
查看>>
ImageLoader must be init with configuration before using
查看>>
spring boot Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration
查看>>
@Override用在哪儿
查看>>
小议C#错误调试和异常处理
查看>>
Python基础--webbrowser
查看>>
Dynamics CRM Form表单中通过javascript抓取触发change事件字段的属性名
查看>>
多维透视表 - 矩表实现商品销售对比统计
查看>>
ssh命令、ping命令、traceroute 命令所使用的协议
查看>>
云舒网络译:Rancher1.0正式版公布
查看>>
转 MySQL中的共享锁与排他锁
查看>>
入门--JTBC系统学习(1)
查看>>
我的Android进阶之旅------>怎样解决Android 5.0中出现的警告: Service Intent must be explicit:...
查看>>
单点登录实现机制:桌面sso
查看>>
JVM垃圾回收机制
查看>>
Oracle导出导入指定表
查看>>