第一种方法取巧
import sys
f_name = sys.argv[0]with open(f_name,'r',encoding='utf-8') as f: content = f.read() print(content)直接读原文件
第二种,经典方法,利用字符串
p = "p = %c%s%c%cprint(p %c(34,p,34,10,37))"
print(p %(34,p,34,10,37))本文共 262 字,大约阅读时间需要 1 分钟。
第一种方法取巧
import sys
f_name = sys.argv[0]with open(f_name,'r',encoding='utf-8') as f: content = f.read() print(content)直接读原文件
第二种,经典方法,利用字符串
p = "p = %c%s%c%cprint(p %c(34,p,34,10,37))"
print(p %(34,p,34,10,37))转载于:https://www.cnblogs.com/cquccy/p/11459209.html