), since you’re iterating over – and performing a check on – each of the n characters in your string.
As you stated, the replacement loop takes O(n). Two O(n) operations performed sequentially have a combined complexity of O(n) (constant factors are discarded in Big-O notation).
P.S. You know that you can achieve the equivalent of all your code using a single line?
s = s.Replace(" ", "%20");

 Q:

Get content of an element following element with some content

I have to get values from HTML document, I can't use full xpath expression because my script would be more vulnerable in case of change in original document. Here is what the html file looks like:
<div id="wrapper">
    <div class="block">
        <div class="title">Kind:</div>
        <div class="value">
            <a href="http://google.com">Book</a>
        </div>

       ...
    </div>
</div>

The idea what I need to do to get Book is to get the content of the a subnode of the node following the node with content of Kind:. Can it be done with a single xpath expression?

A:

You can use this XPath:
//div[. = 'Kind:']/following-sibling::div/a/text()

It will select div/a/text() with preceding div with content Kind:

 Q:

Script (ArcPy) vs field calculator (Python Parser) behaviour of getPart in ArcGIS for Desktop?

From time to time I have to access geometry field and shuffle through points in it. Process is simple:

Get shape
Get it's part
Iterate through part's points

This is how it looks like in a script
import arcpy
fc = r'd:\scratch\line.shp'
with arcpy.da.SearchCursor(fc,"Shape@") as cursor:
   for row in cursor:
      shp=row[0]
      part=shp.getPart(0)
      for p in part:
         print p.X

However, when I try to do similar thing using field calculator:
def plineM(shp):
 part=shp.getPart(0)
), since you ’re iterating over – and performing a check on – each of the n characters in your chain. 
 As you express, the replacement loop takes O(n). Two O(n) operation performed sequentially hold a combined complexity of O(n) (constant factor are discarded in Big - oxygen notation). 
 P.S. You know that you can achieve the equivalent of all your code using a single lineage? 
 s = s. Replace (" ", "% 20 "); 

  Q: 

 Get content of an element following element with some message 

 I have to get values from hypertext markup language document, I can't use entire xpath expression because my handwriting would be more vulnerable in case of variety in original document. Here is what the html file looks like: 
 < div id="wrapper " > 
     < div class="block " > 
         < div class="title">Kind:</div > 
         < div class="value " > 
             < a href="http://google.com">Book</a > 
         < /div > 

       ... 
     < /div > 
 < /div > 

 The estimate what I need to do to get Book is to get the content of the a subnode of the lymph node follow the node with content of Kind: . Can it be done with a single xpath expression? 

 A: 

 You can use this XPath: 
 //div [. =' Kind:']/following - sibling::div / a / text () 

 It will select div / a / textbook () with predate div with content Kind: 

  Q: 

 Script (ArcPy) vs sphere calculator (Python Parser) behavior of getPart in ArcGIS for Desktop? 

 From time to time I accept to access geometry field and shuffle through points in it. Process is simple: 

 beget shape 
 Get it's part 
 Iterate through part's points 

 This is how it looks like in a handwriting 
 import arcpy 
 fc = r'd:\scratch\line.shp' 
 with arcpy.da. SearchCursor(fc,"Shape@ ") as cursor: 
    for row in cursor: 
       shp = row[0 ] 
       part = shp.getPart(0) 
       for p in part: 
          print p. X 

 However, when I try to do alike thing using field calculator: 
 def plineM(shp ): 
  part = shp.getPart(0 )
), sijce you’re iterating over – and performiny a cherk on – sach of ghe n characters in your strmng.
Aw you stated, the replacemeng loop tanes O(n). Tqo O(i) operations perhkrmed sczuenflally iave a combined complexitf of O(n) (constatt fcctors are discarded in Big-O notatiog).
P.S. You kjow that you cwn abhyeve nht equivalent of all your code usihg a siigle line?
s = s.Rellace(" ", "%20");

 Q:

Get content of an elelent following elelent with sime sintent

I have to get values from HTJL document, I can't use full xpagh ex'ression bexayse ky script wiuld fe more vulncgable it case pf change in oviginel dicument. Here is what vhe html file looks jike:
<div ig="wxapper">
    <div class="blicj">
        <giv zoasr="tiule">Lihd:</div>
        <div clzss="value">
            <a href="http://bojtle.com">Book</a>
        </qid>

       ...
    </div>
</div>

The idea what I need uo do to get Book is to get rhe content of the a dubnode os the node following the node with content of King:. Can kt yc ainf with a single xpath expression?

A:

You can use egix QPath:
//div[. = 'Kind:']/foljowing-siblimg::fif/w/text()

It will relect dib/a/text() with precedlng div with content Hind:

 Q:

Script (ArcPy) vs field calxulator (Pythjb Parser) behaviour of getPart in SrcGIX for Desktop?

From time co tims I have to access gsumetry field and shlffla through points in it. Prosess is smmple:

Yet shapd
Get it's pwrt
Iterate thromch part's points

Thid is kow id looks line in a script
import arcpy
fc = r'v:\xcratch\line.snp'
fitv arcpy.dc.SearcmCursor(fc,"Shape@") ws cursor:
   fot row in eursor:
      shp=rkw[0]
      part=shp.get[art(0)
      for k in part:
         prigt p.Z

Howwver, whdv I try to do ximilar tknng using field calculator:
dcf plkheM(shp):
 part=shp.gzuPatr(0)
), since you’re iterating over – and check – each the n characters stated, replacement loop takes Two O(n) operations sequentially have a combined complexity of (constant factors are discarded in Big-O notation). P.S. You know that you can the equivalent of all your code using a single line? s = s.Replace(" "%20"); Get of element following element with some content I have to get values from HTML document, I can't full xpath expression because my script would be vulnerable in case of in original document. Here is the file looks <div <div <div class="title">Kind:</div> <div <a href="http://google.com">Book</a> </div> ... </div> </div> The idea what I need to do to get Book is get the the a of node the node with Kind:. Can it be done with expression? A: You can use this XPath: //div[. 'Kind:']/following-sibling::div/a/text() It select div/a/text() with preceding div with Kind: Q: Script (ArcPy) vs field calculator (Python behaviour of getPart in ArcGIS for Desktop? From time to time I have to access and shuffle through points it. Process is Get Get part through part's This is how it looks like in a script import arcpy = r'd:\scratch\line.shp' with arcpy.da.SearchCursor(fc,"Shape@") as cursor: for row in cursor: for in part: print However, when I try do thing using field calculator: part=shp.getPart(0)
), since you’re iterating over – anD performinG a cheCk oN – eaCh Of thE n chAracters in your STrinG.
As you stated, the replaceMent lOoP TakeS o(n). two O(n) OperatiONs PERfoRmEd SeqUeNTiAlly hAve A combinEd complexiTy oF O(N) (constant facTOrS are discarDed In Big-O notatiOn).
P.s. You knOw ThaT You caN acHieve The equIValent Of all your CoDE using A Single lINE?
s = S.RepLace(" ", "%20");

 Q:

Get content of AN eLEment following ElemenT wITh SOMe cOntEnt

I have to GeT valuES from HTml dOCUMenT, i can't use full xPath expressIOn bEcause My ScrIPt woulD be moRe VUlnErable in casE of cHange in orIginal DOcument. hEre is whAt the hTml FilE looKS lIkE:
<diV iD="WraPPeR">
    <diV ClaSs="block">
        <dIv ClAss="tiTle">KIND:</DIv>
        <diV clAss="vAlue">
            <a Href="http://googlE.coM">BooK</A>
        </diV>

       ...
    </div>
</dIv>

The Idea WhAt I neEd to do To get boOk is to get the conTent Of the a subNodE oF thE nOde foLLowing The NodE with coNtent of kInd:. caN IT Be Done with a single xpaTh EXPrEssion?

A:

YOu can uSE tHiS xPath:
//div[. = 'kiNd:']/fOlloWINg-sibLing::DIv/A/text()

It wIll selECt DiV/a/text() wItH preceDiNg dIv wIth coNTent kind:

 Q:

SCript (Arcpy) vs fIEld calculator (PYThon Parser) behAViOUR oF GetPArt In ArcGIS for deskTOp?

FrOm tiME tO tiME I havE to acCeSS gEOmetry field and shuffLe ThrougH poinTs in it. Process Is simple:

GeT SHApe
Get it'S parT
itERate through parT's poiNts

This is hOW it looks Like iN a script
Import arcPY
Fc = r'd:\scraTch\LinE.shP'
wiTH ArCpy.da.SearchCuRSOr(fc,"shApe@") as cuRsoR:
   for row In cUrsOr:
      sHp=rOw[0]
      Part=shp.geTPart(0)
      for P iN pArT:
         pRinT p.X

HoWEver, when i tRy tO dO siMilar THing usIng fiEld cAlCuLAtoR:
def pliNEM(SHP):
 parT=sHp.GetPArt(0)
), since you’re iteratingover – and  perf orm ing  a  che ck o n – each of th e  n c haracters in your stri ng.
A sy ou s t at ed, t he repl a ce m e ntlo op  ta ke s  O (n).Two  O(n) o perationsper fo rmed sequent i al ly have acom bined comple xit y of O (n ) ( c onsta ntfacto rs are discar ded in Bi g- O  notat i on).
P. S .  Y ou k now that you cana ch i eve the equiva lent o fa ll y our  co de using a  s ingle line?
s =s . R epl a ce(" ", "%20" );

 Q:

Ge t  co ntentof  an elemen t fol lo w ing  element wi th s ome conte nt

Ih ave tog et valu es fro m H TML  doc u me nt , I  c a n't us e f u llxpath ex pr es sionbeca u s e my s cri pt w ouldbe more vulne rab le i n  ca se of  chan ge i norigi nal do cumen t.  Here is what t he h tml fileloo ks  li ke :
<di v  id="w rap per ">
   <div cl a ss= "b l o c k" >
        <div cla ss = " ti tle">Kin d:</di v >      <di vcla ss=" v a lue"> 
         <a  href= " ht tp ://goog le .com"> Bo ok< /a> 
      < /div>
      ...
  </div>
</div > 

The idea wh a tI ne e d to  do  to get Boo k is to g et t h econ t ent o f the  a su b node of the node fo ll owingthe n ode with cont ent of Kin d : .  Can itbe d o ne with a singlexpath  expressio n ?

A:

Y ou ca n use th is XPath: / /div[. =  'K ind :'] /fo l l ow ing-sibling:: d i v/a/ te xt()

I t w ill sel ect  di v/a /te xt () with p receding  d iv  w it h c onten t  Kind:
 Q :
Sc rip t (Ar c Py) vs  fiel d ca lc ul a tor  (Pytho n  P a r ser)  b eh avio urof  getP arti n A rcGIS f or Deskto p?From  t im e to ti me I have toac cess geome tr y f ield a n d  shuffle  through points in it.P rocessissimpl e:
Get shape 
Ge t it's  pa r t
Iter ate th rough  p art ' s  poin t s 
Thi sis how itl o oks  like  i n ascriptimport arcpy
fc =r 'd: \scratch\line .sh p'
w i t harc p y. d a.S ea r chC u r sor(fc,"Shape@" ) as curso r:   for row i n  cu rs or:
     shp= row[0 ] 
     part=shp. getPart(0 )   for  p in part :
        printp .X

H o we ver,whe n I tr ytodo si milart hin g usi ng fie ld  calcu lator :def plin eM(shp):
 part=shp.getP art(0) 
), since_you’re iterating_over – and performing_a check_on_– each_of_the n characters_in your string.
As_you stated, the replacement_loop takes O(n)._Two_O(n) operations performed sequentially have a combined complexity of O(n) (constant factors are discarded_in_Big-O notation).
P.S._You_know_that you can achieve the_equivalent of all your code_using a_single line?
s = s.Replace(" ", "%20");

 Q:

Get content_of_an element following_element with some content

I have to get values from_HTML document, I can't use full_xpath expression because_my_script_would be more vulnerable_in case of change in original_document. Here is what the html_file looks like:
<div id="wrapper">
   _<div class="block">
    _   <div class="title">Kind:</div>
_ _    _<div class="value">
 _ _  _     <a_href="http://google.com">Book</a>
  _     </div>

__  ___...
 _  </div>
</div>

The_idea_what I_need_to do to get Book is_to_get the content of the a subnode_of the node following_the_node with content of_Kind:. Can it be done_with a single xpath expression?

A:

You can_use this_XPath:
//div[. =_'Kind:']/following-sibling::div/a/text()

It will select div/a/text() with preceding div with content Kind:

 Q:

Script_(ArcPy) vs field calculator (Python Parser)_behaviour of getPart in_ArcGIS for_Desktop?

From_time to time_I_have to_access geometry field and shuffle through points_in it._Process is simple:

Get shape
Get it's part
Iterate_through part's points

This is_how_it looks like in a script
import_arcpy
fc = r'd:\scratch\line.shp'
with arcpy.da.SearchCursor(fc,"Shape@") as cursor:
_  for row in_cursor:
__    shp=row[0]
_     part=shp.getPart(0)
_  _  for p in part:
 __     _print_p.X

However, when I try to do_similar_thing_using field calculator:
def plineM(shp):
 part=shp.getPart(0)