初入python

本文是针对初学者的Python编程入门教程,涵盖了Python的基础语法、数据类型、控制结构等内容,帮助读者快速掌握Python编程基础。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  python:
1.文本输入带引号,其中 ‘ ," , '"相同,输入文本返回文本,返回文本带‘***’单引号;
2.通过print方法打印文本,返回文本内容,不会返回引号;
3.>>> print("I said,"Don't do it")  该句会报错:SyntaxError: invalid syntax  
     1.用“/”进行转译 
     >>>print("I said,\"Don't do it\"")      
     I said,"Don't do it"

    1.     """ 三引号 可以输入多行文本     \n 换行(pdf上面说 python 3.0 有  >>>print("hello","world")---hello world)

>>> "hello" "world"
'helloworld'
>>> print(""" w)
ar  """)
 w)
ar
>>> print("i said \n \"hello world \"")
i said
 "hello world "
>>> print("hello","world")
('hello', 'world')

    1. %s  是占位符 具体用法 一个%s 表示一个占位符 %10s表示该出应该放入一个10个字符的字符串 one 自由三个字符串前面用空格代替 若为%-5 则是从左开始算

>>> "Join %s%s" %("every","man")
'Join everyman'
>>> "%s  %s  %10s" %("join","every","one")


疑问:
>>> "\a\b\c\d\e\f\g\h\j\k\l\m\n\o\p"
'\x07\x08\\c\\d\\e\x0c\\g\\h\\j\\k\\l\\m\n\\o\\p'
>>> print( "rock a by baby,\n\ton the tree top,\t\when the windbows\n\t\t\t the crdel")
rock a by baby,
    on the tree top,    \when the windbows
             the crdel
这是什么意思
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值