[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Python - At lede efter en bestemt patten ..



27 jan 2011 kl. 17:33 skrev Henrik Jess Nielsen <sslug@sslug>:

> Hej Gruppe,
> 
> Findes der noget bedre alternativ til at gøre flg. Jeg vil selvfølgelig ha slettet alt mellem [ og ] ...
> 
> Jeg undrede mig over jeg ikke kunne finde et standart lib til at gøre den slags her - har jeg overset noget?
> 
> #!/usr/bin/python
> val="[Hip]Hurra_-_Noget-(Test)-Data"
> x=0
> for i in val:
>  if val[x] == "]":
>    print val[x+1:]
>  x=x+1
> 


str.find(sub[, start[, end]])
Return the lowest index in the string where substring sub is found, such that sub is contained in the slice s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 if sub is not found.

 print val[val.find(']')+1:]


Björn
Skickat från min iPad


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-02-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *