Difference between these two lists?

andydtaylor at gmail.com andydtaylor at gmail.com
Mon Jan 7 20:00:38 EST 2013


Hi,

Python newbie here again - this is probably a quick one. What's the difference between the lines I've numbered 1. and 2. below, which produce the following results: 

Results:
1. [ANG, BAR, BPK, CTN, QGH, QHD, KXX]
2. ['ANG', 'BAR', 'BPK', 'CTN', 'QGH', 'QHD', 'KXX']

Code:
   cursor_from.execute('SELECT * FROM tubestations LIMIT 1000')
   
   stn_list_short = []
   for row in cursor_from:
      if row[4]:
	# Station values for database
	stn_list_short.append(row[5])

   1. print stn_fields = '[%s]' % ', '.join(map(str, stn_list_short))  
   2. print stn_list_short

Thanks!

Andy



More information about the Python-list mailing list