首页
HTML/CSS
浏览器脚本
服务器脚本
数据库
应用编程
XML系列教程
建站手册
代码示例:(标识:python_ref_vars)
运行代码
python_ref_vars.py
class Person: name = "Bill" age = 63 country = "USA" x = vars(Person) print(x)
运行结果:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Python Result</title> <style> * { margin: 0; padding: 0; } body { background: #000000; color: #ffffff; line-height: 1.5; font-family: consolas,"courier new",monospace; } #python_result { padding: 8px; } </style> </head> <body> <div id="python_result"> C:\Users\My Name>python python_ref_vars.py<br />{'__module__': '__main__', 'name': 'Bill', 'age': 63, 'country': 'USA', '__dict__': <attribute '__dict__' of 'Person' objects>, '__weakref__': <attribute '__weakref__' of 'Person' objects>, '__doc__': None}<br /></div> </body> </html>