python dizesini baytlara

Bir nesneyi bir dize kalƒ±bƒ± kullanarak i≈ülemek istiyorsanƒ±z, re kitaplƒ±ƒüƒ±na bir dize saƒülamalƒ±sƒ±nƒ±z. "bayt‚" veri turu, "TypeError: bayt benzeri bir nesnede dize deseni kullanamazsƒ±nƒ±z‚" error.

Bu kƒ±lavuz, bu hatanƒ±n ne anlama geldiƒüi ve bu hatayla neden kar≈üƒ±la≈üabileceƒüiniz hakkƒ±nda konu≈üuyor. Hatayƒ± ç√∂zmek için hangi adƒ±mlarƒ±n atƒ±lacaƒüƒ±nƒ± g√∂rebilmeniz için size bu hatanƒ±n bir √∂rneƒüini g√∂stereceƒüiz.

TypeError: bayt benzeri bir nesnede dize kalıbı kullanamaz

Bytes nesneleri bir dizi tek bayt içerir. Dizeler gibi deƒüi≈ümezler, yani deƒüi≈ütirilemezler. Bir ikili dosya okuduƒüunuzda veya "request‚" bir web sitesinden veri almak için.

re kitaplƒ±ƒüƒ±nƒ± kullanƒ±rken, bayt veya nesneler kullanarak çalƒ±≈ümanƒ±z gerekir. Bir bayt nesnesi için dize kalƒ±plarƒ± belirtemezsiniz ve bunun tersi de geçerlidir.

Bayt verileriyle çalƒ±≈üƒ±yorsanƒ±z, programƒ±nƒ±z bayt cinsinden bir normal ifade kalƒ±bƒ± belirtmelidir. Dizelerle birlikte normal ifade kullanƒ±yorsanƒ±z, dize tabanlƒ± bir normal ifade kalƒ±bƒ± saƒülayƒ±n.

Örnek Senaryo

Bir web sayfasƒ±nƒ±n ba≈ülƒ±ƒüƒ±nƒ± alan bir program yazacaƒüƒ±z. Bu eƒüitim için Python.Engineering web sitesiyle çalƒ±≈üƒ±yoruz.

Ba≈ülamak için, ihtiyacƒ±mƒ±z olan iki kitaplƒ±ƒüƒ± içe aktaralƒ±m programƒ±mƒ±zƒ± olu≈üturmak için: urllib ve re.

urllib kitaplığı web istekleri yapmamıza izin verir ve re kitaplığı bize programımızda normal ifade kullanma yeteneği verir.

Katƒ±lƒ±mcƒ±larƒ±n %81’i, bir eƒüitim kampƒ±na katƒ±ldƒ±ktan sonra teknik i≈ü beklentileri konusunda daha emin hissettiklerini belirtti. Bugun bir eƒüitim kampƒ± ile e≈üle≈ütirin.

Ortalama bir eƒüitim kampƒ± mezunu, bir eƒüitim kampƒ±na ba≈ülamaktan ilk i≈üini bulmaya kadar, kariyer geçi≈üinde altƒ± aydan az zaman harcadƒ±.

Sonra, bir < Python.Engineering ana sayfasına bir href="/what-is-http/">web isteği:

Program a≈üaƒüƒ±dakilerin içeriƒüini alƒ±r Python.Engineering ana sayfasƒ±. Bu veriler, urlopen() y√∂nteminin bir parçasƒ± olan read() y√∂ntemi kullanƒ±larak okunur. Bu verileri "res‚" deƒüi≈üken.

Artƒ±k programƒ±mƒ±zdan gelen verilere sahip olduƒüumuza g√∂re, sorguladƒ±ƒüƒ±mƒ±z web sayfasƒ±ndaki etiketinin içeriƒüini bulmak için <code>search()</code> y√∂ntemini kullanƒ±n. etiketi bir web sayfasƒ±nƒ±n ba≈ülƒ±ƒüƒ±nƒ± içerir.<br></p> <p>Web sayfasƒ±nƒ±n ba≈ülƒ±ƒüƒ±nƒ± bulmak için <code>re.search()</code> y√∂ntemini kullanƒ±n:<br></p > <p>Programƒ±mƒ±z <title> etiketinin içeriƒüini arayacaktƒ±r. Programƒ±mƒ±z daha sonra web sayfasƒ±nƒ±n ba≈ülƒ±ƒüƒ±nƒ± konsola yazdƒ±rƒ±r.Bu ba≈ülƒ±ƒüƒ± dizemize eklemek için <a href="/python-f-string/">.format() y√∂ntemini</a> kullanƒ±rƒ±z. <br></p> <p>Programƒ±mƒ±zƒ± çalƒ±≈ütƒ±ralƒ±m ve çalƒ±≈üƒ±p çalƒ±≈ümadƒ±ƒüƒ±nƒ± g√∂relim:<br></p> <p>Programƒ±mƒ±z tam olarak yurutulemiyor.</p><p>"home‚" (web sayfamƒ±zdan gelen yanƒ±t) bir bayt nesnesidir, ancak bir web sayfasƒ±nƒ±n ba≈ülƒ±ƒüƒ±nƒ± bulmak için kullandƒ±ƒüƒ±mƒ±z kalƒ±p bir dizedir. Bu bir hataya neden olur çunku dize kalƒ±plarƒ±nƒ± bayt nesnelerle e≈üle≈ütiremeyiz.<br></p> <p>Bu sorunu ç√∂zmenin iki yolu vardƒ±r.</p> <h3>√á√∂zum #1: Dize Kalƒ±bƒ±nƒ± Bayt’a D√∂nu≈ütur ;</h3> <p>Kullandƒ±ƒüƒ±mƒ±z string deseni bytes nesnesine çevirmeliyiz. Bunu, "b‚" anahtar kelime veya <code>bytes()</code> y√∂ntemi:<br></p> <p>"b‚" Anahtar kelime daha yaygƒ±ndƒ±r çunku okunmasƒ± daha kolaydƒ±r. Artƒ±k dize modelimizi baytlara d√∂nu≈üturduƒüumuze g√∂re, kodumuzu çalƒ±≈ütƒ±rabiliriz:<br></p> <p>Kodumuz, sorgumuzla e≈üle≈üen metni d√∂ndurur.<br> </p> </a></div><p>Artƒ±k normal ifade yanƒ±tƒ±na sahip olduƒüumuza g√∂re, kodumuzda bir dize olarak g√∂runmesi için onu ayrƒ±≈ütƒ±rabiliriz.Normal ifade verilerini ayrƒ±≈ütƒ±rmak bu √∂ƒüreticinin kapsamƒ± dƒ±≈üƒ±ndadƒ±r. </p> <h3>√á√∂zum #2: Web Sayfasƒ± Verilerinin Kodunu √á√∂z</h3> <p>Alternatif olarak, web sayfasƒ± verilerimizi bir dize yapmak için ç√∂zmeyi seçebiliriz.Diƒüer kƒ±sƒ±mlar için bir dize bekliyorsanƒ±z bu kullanƒ±≈ülƒ±dƒ±r <br></p> <p>Web sayfasƒ±nƒ± açtƒ±ƒüƒ±mƒ±z kod satƒ±rƒ±nƒ± deƒüi≈ütirerek web sayfasƒ± verilerimizin kodunu ç√∂zebiliriz:<br></p> <p>Bu kod, yanƒ±tƒ± bir dize gibi ele alabilmemiz için web isteƒüimizden gelen yanƒ±tƒ±n kodunu ç√∂zecektir. "utf-8‚"’i e y√∂ntemiyle deƒüi≈ütirmelisiniz. Talep ettiƒüiniz web sayfasƒ±nƒ± kodlama kullanƒ±r.<br></p> <p>Ardƒ±ndan ba≈ülƒ±k etiketini aramak için bir dize kalƒ±bƒ± kullanabiliriz. Desenimizi bir bayt nesnesine d√∂nu≈üturmeye gerek yok çunku "home‚" bir dize deƒüeri olacaktƒ±r.</p> <p>Kodumuzu çalƒ±≈ütƒ±ralƒ±m ve g√∂relim ne olur: <br></p><p>"Python.Engineeringsƒ± hayatƒ±ma en çok ihtiyacƒ±m olduƒüu anda girdi ve hƒ±zlƒ± bir ≈üekilde bir eƒüitim kampƒ±na uyum saƒülamama yardƒ±mcƒ± oldu. Mezun olduktan iki ay sonra, deƒüerlerime uygun hayalimdeki i≈üi buldum ve hayattaki hedefler!"</p> <p class="testimonial-section-faint-1">Venus, Rockbot’ta Yazƒ±lƒ±m Muhendisi</p> <p>"TypeError: bir bayt uzerinde bir dize kalƒ±bƒ± kullanamaz -benzeri nesne‚" bayt veri turu kullanƒ±larak saklanan bir nesneyle bir dize modelini e≈üle≈ütirmeye çalƒ±≈ütƒ±ƒüƒ±nƒ±zda hata olu≈üur.<br></p> <p>Bu hatayƒ± dize modelinizi bir bayt nesnesine d√∂nu≈üturerek veya birlikte çalƒ±≈ütƒ±ƒüƒ±nƒ±z verileri bir dize nesnesine d√∂nu≈üturerek.<br></p> </a></div><p>Artƒ±k bu <a href="/how-long-to-learn-python/">Python hatasƒ±nƒ± bir profesyonel gibi</a> duzeltmeye hazƒ±rsƒ±nƒ±z. !</p> </div> </div> <div class="article__right"> <div class="hub_ad"> <div id="ezoic-pub-ad-placeholder-106"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746" crossorigin="anonymous"></script> <!-- PYE aside NEW --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-9381065361874746" data-ad-slot="8755532771" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="shop-aside shop-aside--mt"> <h2 class="shop-aside__title">Shop</h2> <div class="shop__items shop__items--column"> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/learn-programming-in-r-courses/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Learn programming in R: courses</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-python-online-courses-for-2022/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best Python online courses for 2022</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-fortnite/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best laptop for Fortnite</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-excel/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best laptop for Excel</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-solidworks/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best laptop for Solidworks</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-roblox/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best laptop for Roblox</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-computer-for-crypto-mining/"></a><img class="shop__item-img" src=""> <p class="shop__item-name">Best computer for crypto mining</p><span class="shop__item-price">$</span> </div> <div class="shop__item"><a class="shop__item-link" href="https://python.engineering/best-laptop-for-sims-4/"></a><img class="shop__item-img" src="http://python.engineering/wp-content/uploads/2022/04/pye-best-laptop-for-sims-4.jpg"> <p class="shop__item-name">Best laptop for Sims 4</p><span class="shop__item-price">$</span> </div> </div> </div> <div class="hub_ad"> <div id="ezoic-pub-ad-placeholder-106" style="position:sticky; position:-webkit-sticky; top:0; margin-top:10px; z-index: 1000"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746" crossorigin="anonymous"></script> <!-- PYE aside NEW --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-9381065361874746" data-ad-slot="8755532771" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="l-questions l-questions--mt"> <p class="l-questions__title">Latest questions</p> <div class="l-questions__list"> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/8134602-psycopg2-insert-multiple-rows-with-one-query/"></a> <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div> <p class="l-questions__item-title">psycopg2: insert multiple rows with one query</p> <p class="l-questions__item-answers"><span>12</span> answers</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/3930188-how-to-convert-nonetype-to-int-or-string/"></a> <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div> <p class="l-questions__item-title">How to convert Nonetype to int or string?</p> <p class="l-questions__item-answers"><span>12</span> answers</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/33945261-how-to-specify-multiple-return-types-using-type-hints/"></a> <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div> <p class="l-questions__item-title">How to specify multiple return types using type-hints</p> <p class="l-questions__item-answers"><span>12</span> answers</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/51922480-javascript-error-ipython-is-not-defined-in-jupyterlab/"></a> <div class="l-questions__item-tags"><span class="l-questions__item-tag violet">NUMPY</span><span class="l-questions__item-tag yellow">NUMPY</span></div> <p class="l-questions__item-title">Javascript Error: IPython is not defined in JupyterLab</p> <p class="l-questions__item-answers"><span>12</span> answers</p> </div> </div> <div class="l-questions__more-link"><a href="/cat/wiki/so/">All questions</a></div> </div> <div class="hub_ad"> <div id="ezoic-pub-ad-placeholder-106" style="position:sticky; position:-webkit-sticky; top:0; margin-top:10px; z-index: 1000"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9381065361874746" crossorigin="anonymous"></script> <!-- PYE aside NEW --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-9381065361874746" data-ad-slot="8755532771" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> </div> </div> </div> <!-- news --> <div class="news"> <div class="container"> <h2 class="news__title h2">News</h2> <div class="news__items"> <!-- <a class="news__item" href="https://python.engineering/famous-programmers-and-developers-cooler-than-rock-stars-and-movie-actors/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/09/pye-famous-29-09-2022.jpeg')"> --> <a class="news__item" href="https://python.engineering/famous-programmers-and-developers-cooler-than-rock-stars-and-movie-actors/" style="background-color: #243978;"> <span class="news__item-overlay"> <span class="news__item-cat">29/09/2022</span> <span class="news__item-title">Famous programmers and developers: cooler than rock stars and movie actors</span> </span> </a> <!-- <a class="news__item" href="https://python.engineering/what-employers-expect-from-a-junior-python-developer/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/09/bcc-junior-python-26-09-2022.jpeg')"> --> <a class="news__item" href="https://python.engineering/what-employers-expect-from-a-junior-python-developer/" style="background-color: #243978;"> <span class="news__item-overlay"> <span class="news__item-cat">26/09/2022</span> <span class="news__item-title">What Employers Expect from a Junior Python Developer</span> </span> </a> <!-- <a class="news__item" href="https://python.engineering/python-vs-r-what-should-a-beginner-data-scientist-choose/" style="background-image: url('https://python.engineering/wp-content/uploads/2022/09/pye-R-25-09-2022.jpeg')"> --> <a class="news__item" href="https://python.engineering/python-vs-r-what-should-a-beginner-data-scientist-choose/" style="background-color: #243978;"> <span class="news__item-overlay"> <span class="news__item-cat">25/09/2022</span> <span class="news__item-title">Python vs. R: what should a beginner Data Scientist choose?</span> </span> </a> </div> </div> </div> <!-- /new --> <br> <!-- wiki --> <div class="wiki"> <div class="container"> <h2 class="wiki__title h2">Wiki</h2> <div class="wiki-grid"> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-puttext-method/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">__del__</span></a> </div> <p class="l-questions__item-title">Python OpenCV | cv2.putText () method</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/numpy-arctan2-python/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">__del__</span></a> </div> <p class="l-questions__item-title">numpy.arctan2 () in Python</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-os-path-realpath-method/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">__del__</span></a> </div> <p class="l-questions__item-title">Python | os.path.realpath () method</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-circle-method/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">around</span></a> </div> <p class="l-questions__item-title">Python OpenCV | cv2.circle () method</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-opencv-cv2-cvtcolor-method/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">cvtcolor</span></a> </div> <p class="l-questions__item-title">Python OpenCV cv2.cvtColor () method</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-move-element-to-end-of-the-list/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">Python functions</span></a> </div> <p class="l-questions__item-title">Python - Move item to the end of the list</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/time-perf_counter-function-in-python/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">Counters</span></a> </div> <p class="l-questions__item-title">time.perf_counter () function in Python</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-check-if-one-list-is-subset-of-other/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">__dict__</span></a> </div> <p class="l-questions__item-title">Check if one list is a subset of another in Python</p> </div> <div class="l-questions__item"><a class="l-questions__item-link" href="https://python.engineering/python-os-path-join-method/"></a> <div class="l-questions__item-tags"> <a href=""><span class="l-questions__item-tag violet">__del__</span></a> </div> <p class="l-questions__item-title">Python os.path.join () method</p> </div> </div> </div> </div> <!-- /wiki --> <!-- new footer --> <footer class="footer"> <div class="container"> <div class="footer__row"> <div class="footer__left"><img class="footer__logo" src="/wp-content/themes/nimani/img/footer-logo.svg" alt="Python Engineering"> <p class="footer__copyright">© 2017—2022 <br> Python Engineering Hub</p> <p class="footer__desc"> <a href="/cat/wiki/" class="footer__nav-link">EN</a> | <a href="/cat/es_sp/" class="footer__nav-link">ES</a> | <a href="/cat/de_de/" class="footer__nav-link">DE</a> | <a href="/cat/fr_fr/" class="footer__nav-link">FR</a> | <a href="/cat/it_it/" class="footer__nav-link">IT</a> | <a href="/cat/ru_ru/" class="footer__nav-link">RU</a> | <a href="/cat/tr_tr/" class="footer__nav-link">TR</a> | <a href="/cat/pl_pl/" class="footer__nav-link">PL</a> | <a href="/cat/pt_pt/" class="footer__nav-link">PT</a> | <a href="/cat/ja_jp/" class="footer__nav-link">JP</a> | <a href="/cat/ko_kr/" class="footer__nav-link">KR</a> | <a href="/cat/zh_cn/" class="footer__nav-link">CN</a> | <a href="/cat/hi_in/" class="footer__nav-link">HI</a> | <a href="/cat/nl_nl/" class="footer__nav-link">NL</a> </p> <br> <p class="footer__desc"> Python.Engineering is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com </p> </div> <div class="footer__nav-col"> <p class="footer__nav-title">Python</p> <ul class="footer__nav-list"> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/loops/">Loops</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/counters/">Counters</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/numpy/">NumPy</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/nlp/">NLP</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/regex/">Regular Expressions</a></li> </ul> </div> <div class="footer__nav-col"> <p class="footer__nav-title">Wiki</p> <ul class="footer__nav-list"> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/news/">Tech news</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/wiki/">Python Wiki</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/wiki/so/">StackOverflow</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/php/">PHP</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/javascript/">JavaScript</a></li> </ul> </div> <div class="footer__nav-col"> <p class="footer__nav-title">Books</p> <ul class="footer__nav-list"> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/books/">All books</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/computations/">Computations</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/development/">Development</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/cryptography/">Cryptography</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/beginners/">For dummies</a></li> <li class="footer__nav-item"><a class="footer__nav-link" href="/cat/bigdata/">Big Data</a></li> </ul> </div> </div> </div> </footer> <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script> <script src="/wp-content/themes/nimani/js/libs.js"></script> <script src="/wp-content/themes/nimani/js/index.js"></script> <script src="/wp-content/themes/nimani/js/vendor/lazysizes.min.js" async></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-Q022WLXW4X" async></script> <script async src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?autoload=true&skin=desert&lang=python"></script> <script type="text/javascript"> document.addEventListener("DOMContentLoaded", () => { let arrayCode = document.querySelectorAll('pre'); arrayCode.forEach(element => { element.classList.add("prettyprint"); }); }); </script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-Q022WLXW4X'); </script> <!-- ===================== LEAVE POPUP ===================== <script src="/wp-content/themes/nimani/js/ouibounce.js"></script> <script> // if you want to use the 'fire' or 'disable' fn, // you need to save OuiBounce to an object var _ouibounce = ouibounce(document.getElementById('ouibounce-modal'), { aggressive: true, timer: 0, delay: 1000, callback: function() { console.log('ouibounce fired!'); } }); $('body').on('click', function() { $('#ouibounce-modal').hide(); }); $('#ouibounce-modal .modal-footer').on('click', function() { $('#ouibounce-modal').hide(); }); $('#ouibounce-modal .modal').on('click', function(e) { e.stopPropagation();}); </script> <script> $("#reload_form_button" ).click(function() { console.log("hui"); $('#reload_form').load('/wp-content/themes/nimani/af.html'); }); </script> ===================== /LEAVE POPUP ===================== --> </body> </html> <!-- /new footer -->