ro  fr  en  es  pt  ar  zh  hi  de  ru
ART 2.0 ART 3.0 ART 4.0 ART 5.0 ART 6.0 Pinterest

पायथन: HTML फ़ाइलों के शरीर में टेक्स्ट फ़ाइलों की सामग्री की प्रतिलिपि बनाएँ

On December 23, 2021, in Leadership Quantum-XX, by Neculai Fantanaru

आप यहां पूरा कोड देख सकते हैं:Https: // passatin.com / VA56 8PN

इंस्टॉलपायथन

मान लें कि हमारे पास कई .txt फ़ाइलें हैं। और हमारे पास केवल एक .html फ़ाइल है

.Html फ़ाइल के शरीर में यह खंड है:तथा। .Txt फ़ाइल में पाठ यहां कॉपी किया जाएगा।

आपको नामित फ़ोल्डर बनाने की भी आवश्यकता होगी:files_html(सभी नई फाइलें यहां सहेजी जाएंगी)। अन्य सभी फाइलें। TXT और .html फ़ाइल फ़ोल्डर के बाहर मुक्त हैं:files_html

आप जितनी चाहें उतनी .txt फ़ाइलें हो सकते हैं। इस तरह की .txt फ़ाइल में केवल पाठ होगा, जैसे कि:

My name probably does not say anything to you, Walter Elias Disney, 
because I just came back from New York and got only 40 dollars in my pocket.
Increasingly, I need spiritual points to help me not get swallowed by the
most painful miscarriage, the saddest abandon in a labyrinth of vanity
where the only marks are self-forgetting and the others, followed in the
end of supreme sacrifice.

आपको केवल एक .html फ़ाइल की आवश्यकता होगी जिसमें निम्न अनुभाग है:



<p class="obisnuit"><em>Honor your moral and spiritual obligations.em>p>
<p class="nint">Bishop knew how to say the most meaningful of things speech.p>

आउटपुट:कोड चलाने के बाद, हमारे पास होगा:



My name probably does not say anything to you, Walter Elias Disney, 
because I just came back from New York and got only 40 dollars in my pocket.
Increasingly, I need spiritual points to help me not get swallowed by the
most painful miscarriage, the saddest abandon in a labyrinth of vanity
where the only marks are self-forgetting and the others, followed in the
end of supreme sacrifice.

कोडुल: किसी भी दुभाषिया कार्यक्रम में नीचे दिए गए कोड को कॉपी और चलाएं(मैं उपयोग कर रहा हूँPyscrcs"Creare_fisiere_html" लाइन पर पथ को बदलने के लिए मत भूलना। HTML HILITE.ME का उपयोग करके उत्पन्न

आयात आप
आयात गरम

डीईएफ़ READ_TEXT_FROM_FILE(दस्तावेज पथ):"" "
यह फ़ंक्शन एक फ़ाइल सामग्री देता है।
FILE_PATH: उस फ़ाइल का तरीका जिसे आप पढ़ना चाहते हैं
"" "
    साथ खुला हुआ(FILE_PATH, एन्कोडिंग='ुत्फ़8')जैसाएफ:
         मूलपाठ=एफपढ़ना()वापसीमूलपाठडीईएफ़ WRITE_TO_FILE(पाठ, FILE_PATH):"" "
यह सुविधा एक फ़ाइल में एक पाठ लिखती है।
पाठ: वह पाठ जिसे आप लिखना चाहते हैं
FILE_PATH: उस फ़ाइल का तरीका जिसे आप लिखना चाहते हैं
"" "
    साथ खुला हुआ(दस्तावेज पथ,'डब्ल्यूबी')जैसाएफ:
         एफलिख (पाठ)एनकोड ('ुत्फ़8','नज़रअंदाज़ करना'))डीईएफ़ COPIAZA_CONTINUT_TXT_HTML(path_fisier_txt, path_fisier_html):# ये फ़ंक्शन के तर्क हैं, जब मैं फ़ंक्शन अपील करता हूं
    # फ़ाइल में पाठ पढ़ेंtext_txt=READ_TEXT_FROM_FILE (CALE_FISIER_TXT)
     text_html=READ_TEXT_FROM_FILE (CALE_FISIER_HTML)# हम फ़ाइल से एक स्ट्रिंग में पाठ को चालू करते हैंtext_txt= एसटीआर(text_txt)
     text_html= एसटीआर(text_html)# अभिव्यक्ति रेगेक्स के लिए यहां पैटर्न है;  (। *?) का अर्थ है कि सभी को टैग के बीच में लेना
    # फ़ंक्शन के लिए एक तर्क के रूप में क्या देता है इस पर निर्भर करता है कि नियमित अभिव्यक्ति को संशोधित करेंअनुच्छेद_पैटर्न=गरमसंकलन (' ([[\ s] *?)  [\ s \ s] *?')
     text_articol=गरमFindall (articol_pattern, text_html)अगर लेन।(Text_articol)! = 0:
         text_articol= एसटीआर(Text_articol [0])
         text_txt= '\ n \ n' +text_txt+ '\ n \ n'text_html=text_htmlबदलें (text_articol, text_txt)
         दस्तावेज पथ=आपपथDirname (cale_fisier_txt)+ "\\" + "FILE_HTML" + "\\" +आपपथSplitext (पथबेसनाम (CALE_FISIER_TXT)) [0]+ '.html'WRITE_TO_FILE (TEXT_HTML, FILE_PATH)प्रिंट("लेखन सफलतापूर्वक किया गया।")अन्य:प्रिंट("स्टार्ट / फाइनल आइटम के बिना एचटीएमएल फ़ाइल।")डीईएफ़ CREATION_FISIERE_HTML(path_folder_txt, path_fisier_html):"" "
फ़ंक्शन को उस फ़ोल्डर द्वारा संचालित किया जाता है जिसमें TXT फ़ाइलें होती हैं और उपयुक्त HTML फ़ाइलें बनाती हैं
"" "
    के लियेएफमेंआपListDir (CALE_FOLDER_TXT):अगरएफइसी के साथ समाप्त होता है('टेक्स्ट'):
                 path_fisier_txt=cale_folder_txt+ "\\" +एफ।
                 copiaza_continut_txt_html (path_fisier_txt, path_fisier_html)अन्य:जारी रखें

डीईएफ़ मुख्य():
     CREATION_FISIERE_HTML ("सी:\\फ़ोल्डर 1 ","सी:\\फ़ोल्डर 1।\\Oana.tuth ")अगर__इसलिए__== '__मुख्य__':
     मुख्य()

That's all folks.

इसके अलावा, यह देखेंसंस्करण 2या संस्करण 3यासंस्करण 4यासंस्करण 5यासंस्करण 6यासंस्करण 7


Latest articles accessed by readers:

  1. An Eye To See And A Mind To Understand
  2. Turn Towards Me With An Eye Full Of Your Own Gaze
  3. The Snapshot Of Magic In God's Universe
  4. Rhythm Of My Heart

Donate via Paypal

Alternate Text

RECURRENT DONATION

Donate monthly to support
the NeculaiFantanaru.com project

SINGLE DONATION

Donate the desired amount to support
the NeculaiFantanaru.com project

Donate by Bank Transfer

Account Ron: RO34INGB0000999900448439

Open account at ING Bank

Join The Neculai Fantanaru Community



* Note: If you want to read all my articles in real time, please check the romanian version !

decoration
About | Site Map | Partners | Feedback | Terms & Conditions | Privacy | RSS Feeds
© Neculai Fântânaru - All rights reserved