栈劫持
整形溢出
实验
2024年08月16日
sys模块代表了Python解释器相关有的信息,主要用来获取解释器的信息。下面的方法提供查看sys模块下的全部程序单元(包括变量和函数等):
>>> import sys
>>> [elem for elem in dir(sys) if not elem.startswith('_')]
['abiflags', 'api_version', 'argv', 'base_exec_prefix', 'base_prefix',
'breakpointhook', 'builtin_module_names', 'byteorder', 'call_tracing',
'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', 'exc_info',
'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',
'float_repr_style', 'get_asyncgen_hooks', 'get_coroutine_origin_tracking_depth',
'get_coroutine_wrapper', 'getallocatedblocks', 'getcheckinterval',
'getdefaultencoding', 'getdlopenflags', 'getfilesystemencodeerrors',
'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount',
'getsizeof', 'getswitchinterval', 'gettrace', 'hash_info', 'hexversion',
'implementation', 'int_info', 'intern', 'is_finalizing', 'last_traceback',
'last_type', 'last_value', 'maxsize', 'maxunicode', 'meta_path', 'modules',
'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'ps1', 'ps2',
'real_prefix', 'set_asyncgen_hooks', 'set_coroutine_origin_tracking_depth',
'set_coroutine_wrapper', 'setcheckinterval', 'setdlopenflags', 'setprofile',
'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr', 'stdin',
'stdout', 'thread_info', 'version', 'version_info', 'warnoptions']
2024年08月16日
Python 是一种广泛使用的编程语言,凭借其简洁的语法和强大的功能,吸引了大量开发者。无论是初学者还是有经验的程序员,都可以通过不断学习和实践,逐步成为 Python3 的高手。本文将详细介绍如何系统地学习 Python3,从基础到高级,逐步突破,最终成为 Python3 高手的路径。
2024年08月16日
我们在实际工作中,经常会遇到通过python命令行的方式来运行py代码的场景,有时候我们还希望在命令行中传入参数,然后在代码中运行,解决这个问题就需要使用sys.argv。sys.argv[]就是一个从程序外部获取参数的桥梁,我们从外部取得的参数可以是多个,所以获得的是一个列表list,也就是说sys.argv其实可以看作是一个列表,所以才能用[]提取其中的元素。其第一个元素是程序本身,随后才依次是外部给予的参数。话不多说上代码!
2024年08月16日
编码
默认情况下,Python 3 源码文件以 UTF-8 编码,所有字符串都是 unicode 字符串。 当然你也可以为源码文件指定不同的编码:
2024年08月16日
编码
默认情况下,Python 3 源码文件以 UTF-8 编码,所有字符串都是 unicode 字符串。 当然你也可以为源码文件指定不同的编码:
# -*- coding: cp-1252 -*-