compair string with a list??
jeremy at jdyallop.freeserve.co.uk
Wed Aug 21 23:54:01 CEST 2002
* jubafre at brturbo.com
| I open a file teste.asm in a list like that:
| x=['\tLDA \tD1', '\tADD \tD2', '\tSTA \tD3', '\tHLT\t', '', 'D1:\tDB \t3', 'D2:\tDB \t2', 'D3:\tDB \t']
| the nodes of the list means the lines of the file opened.
| I want to compair one string with a part of line
| for example 'LDA'==x, this not true because x is all the node ('\tLDA \tD1'),
| i want to compair 'LDA'== '\tLDA', how i can get this??????
Depending on exactly what you want, try:
'LDA' == x.split(' ')
'LDA' == x[:4]
More information about the Python-list