# Python学习
# 学习时间: 2022/6/27 15:12
import paddle
# 输出字符或字符串
print("hello")
print('hello')
# 输出数字
print(4222)
# 输出表达式
print(4+1/2)
# 将数据输入到文件中
# 注意点:1.所指定的盘符;2.使用file= fp
fp=open('D:/text.txt','a+') # "a+": 如果文件不存在则创建,如果存在则继续添加
# print('helloworld',fp)
print('helloworld',file=fp)
fp.close()
# 不进行换行输出
print("hello",'world','!')
# 转义符
# // 反斜杠 /" 双引号 /' 单引号 /n 换行 /r 回车(“后面的内容覆盖/r前面的内容”) /t 水平制表符 /b 退格
print('hello/rworld')
print('hello/bworld')
print('http:////www.baidu.com')
print('老师说:/"大家好/"')
# 原字符:不希望字符串中的转义字符起作用,使用原字符,就是在字符串之前加上r或R
print('hello/nworld')
print(r'hello/nworld')
# 注意:使用r时,最后一个字符不能是反斜杠 print(r'hello/nworld/')
原创文章,作者:506227337,如若转载,请注明出处:https://blog.ytso.com/tech/python/272955.html