List of strings

M

Mohammed Altaj

Hi All

Thanks for your reply , what i am doing is , i am reading from file ,
using readlines() , I would like to check in these lines , if there is
line belong to another one or not , if it is , then i would like to
delete it

['0132442\n', '13\n', '24\n']

'13' is already in '0132442'
'24' is already in '0132442'

Thanks
 
P

Paul Watson

Mohammed said:
Hi All

Thanks for your reply , what i am doing is , i am reading from file ,
using readlines() , I would like to check in these lines , if there is
line belong to another one or not , if it is , then i would like to
delete it

['0132442\n', '13\n', '24\n']

'13' is already in '0132442'
'24' is already in '0132442'

Thanks

$ python
Python 2.4.1 (#1, Jul 19 2005, 14:16:43)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.S.find(sub [,start [,end]]) -> int

Return the lowest index in S where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.

Return -1 on failure.
 
?

=?ISO-8859-1?Q?Tomi_Ky=F6stil=E4?=

Paul said:
Mohammed said:
Hi All

Thanks for your reply , what i am doing is , i am reading from file ,
using readlines() , I would like to check in these lines , if there is
line belong to another one or not , if it is , then i would like to
delete it

['0132442\n', '13\n', '24\n']
'13' is already in '0132442'
'24' is already in '0132442'
Thanks


$ python
Python 2.4.1 (#1, Jul 19 2005, 14:16:43)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.S.find(sub [,start [,end]]) -> int

Return the lowest index in S where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.

Return -1 on failure.

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,263
Messages
2,571,312
Members
47,988
Latest member
HarryBeck

Latest Threads

Top