[Tutor] TypeError: can only concatenate list (not "str") to list

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Sun Jan 30 21:43:06 CET 2005


Hello group,
 I am trying to print rows from two lists together:

how can i deal with TypeError' where i have to print a
list and a string. 

for line in pb:  # tab delim text with 12 columns
	cols = line.split('\t')
	temp_seq = cols[7].split('\n') # extract 7thcol
	seq = temp_seq[0].split(',') #splitting it by ,
	for nm in seq:
		for i in range(len(nmrows)):
			if nm == nmrows[i][0] and nmrows[i][3] < cols[4]
and nmrows[i][4] > cols[5]:
				nmr = nmrows[i]
				pbr = cols[0]
				print nmrow[i] +'\t'+cols[0]



I tried the following also :

I created an empty list outside for loop and tried to
extend the elements of the list and string

nmr = nmrows[i]
pbr = cols[0]
result.extend(nmr+'\t'+pbr)

# result is the list i created. nmr is a list, and pbr
is a string. 

can any one plaease help.

thanks
Srini


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 



More information about the Tutor mailing list