我确信这很简单,但无法开始工作。我想迭代定义变量的所有attr和方法。但是我保留了3个错误之一:
None
(多次退回)... has no attribute 'b'
[]
(多次退回)使用BeautifulSoup对象,但下面以dir(string)
为例。无论如何都会出错。
start = "Hello"
for b in dir(start):
print b # can successfully get list of all attr & methods
for b in dir(start):
print start.b # should print-out command one @ a time iterating over each..not working
有什么想法吗?