- count()默认打印所有记录
- 如果要配合find,limit,count使用,需要传入count(True)
返回表示当前工作目录的unicode字符串。
file- 按相对路径./xxx.py来执行,则打印得到的是相对路径,可能为空。
- 按绝对路径执行则得到的是绝对路径。
- 结合os.path.abspath用,效果会好。
import os print(os.getcwd()) print(__file__) print(os.path.realpath(__file__)) print(os.path.abspath(__file__)) print(os.path.dirname(__file__))
以python xxx.py启动脚本时,拿os.path.dirname(__file__)去拼接路径,会得到空值。



