输出包含共同元素的变量值 #coding:utf-8 def main(): a1=1 a2=2 a3=3 for i in xrange(1,4): print eval("a%d" % i) # 或:exec('print a%d' %i) if __name__ == '__main__': main()