Exercise22(操作文件的函数以及一些符号)

ex22_list.txt

print("something")      # show something on the terminal
print("age: ", 23)
print("age: ", 20 + 3)
print("age: ", age)
print(f"age: {age}")
print("age: { }".format('23'))


round()                 # round(1.7333) = 2
                                round(1.7333, 2) = 1.73


input()                 # accept a stander input, return a string


open()                 # open the file
close()                 # close the file
f.read()                # read the contents of the file
f.readline()          # read just one line of the file
f.write('stuff')      # write 'stuff' to the file
truncate              # empties the file
seek(0)                # move the read/write location to the beginning of the file




end = ''                # not end the line with a \n


from sys import argv             # get argv from the pakage(sys)
from os.path import exists    # get exists from the os.path


echo "I love qj." > test.txt     # transport the string to test.txt


def                     # define a function


#                        # octothorpe or pound
+                        # plus
-                         # minus
/                         # slash
\                         # backslash
*                         # asterisk
%                        # percent
<                        # less-than
>                        # greater-than
=                        # single-equal
==                      # double-equal
<=                      # less-than-equal
>=                      # greater-than-equal
'                          # single-quotes
"                         # double-quotes
'''                        # three single-quotes
"""                      # three double-quotes
\n                       # backslash n
\t                        # backsalsh t
:                          # colon

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值