Scripting with Python - Modify a TXT file

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 33

  • @hymavathipaladugu4404
    @hymavathipaladugu4404 3 หลายเดือนก่อน +1

    the hello it pros fot me🤣
    But the rest of the vid is fire

  • @ericholland_LTD
    @ericholland_LTD ปีที่แล้ว +2

    Oh my gosh thank you so much I had all the code written and no idea how to put it in a new file

  • @karicallegra8194
    @karicallegra8194 3 ปีที่แล้ว +10

    So a faster way to do this would be to use the rstrip on the line item when you append them to the list during your initial read. So it would read like "listOfMacs.append(line.rstrip())" which would give you a list of items with the "
    " already stripped. Then you could just use in-place formatting instead of the for loops to replace the "-" and add the newline back. So for example, "listOfMacs = ['{0}
    '.format(element.replace("-", ":").lower()) for element in listOfMacs ]" this would give you back a list that you could just then write to the new text file. I don't know if this is more/less performant but def is less code!!

    • @1staryelpreview689
      @1staryelpreview689 3 ปีที่แล้ว +1

      I would assume it is more performant because it uses less for loops:
      with open(path_to_mac_list,"r") as reader:
      list_of_macs=[]
      for line in reader.readlines():
      list_of_macs.append(line.rstrip("
      "))
      list_of_macs = ['{0}'.format(element.replace("-", ":").lower()) for element in list_of_macs]
      You could even do something like this:
      with open(path_to_mac_list,"r") as reader:
      list_of_macs=[]
      for line in reader.readlines():
      list_of_macs.append(line.rstrip("
      ").replace("-", ":").lower())

  • @arpsri9675
    @arpsri9675 9 หลายเดือนก่อน +1

    This video is my "GOD" , thank you so much

  • @exonoia
    @exonoia 3 ปีที่แล้ว +2

    hey sir, your video is totally clear. how the way you describe in every single step. very excited.!! let me to learn many thing from your youtube channel. thankyou

  • @shrikantagashe9449
    @shrikantagashe9449 2 ปีที่แล้ว +1

    Thank you man for saving my day 🙌🙌

  • @CharJlJly
    @CharJlJly 2 ปีที่แล้ว +1

    thanx a LOT, man. You are wizzard from other planet

  • @eliehaddad84
    @eliehaddad84 2 ปีที่แล้ว +2

    Extreme good explanation 👍🏼

  • @manishmurari6494
    @manishmurari6494 3 ปีที่แล้ว +5

    Explained really good...thank you

  • @tendinginfinity
    @tendinginfinity 3 ปีที่แล้ว +2

    Great man looks like i understand all thank you so much 👌👌👌👌👌👌

  • @maxwellsalmon5160
    @maxwellsalmon5160 3 ปีที่แล้ว +3

    Legend, thank you.

  • @debanjansen1282
    @debanjansen1282 3 ปีที่แล้ว +2

    Extremely good tutorial

  • @xerogaming2127
    @xerogaming2127 3 ปีที่แล้ว +1

    How can we save data in key value type way , for example saving a conversation between two people ?

  • @jadkhalil9263
    @jadkhalil9263 ปีที่แล้ว +1

    Thanks very good video

  • @civil3dsimplified64
    @civil3dsimplified64 2 ปีที่แล้ว

    Can we use "import os" instead "with open method"?
    And thanks for over simplification of these concepts

  • @kristydenali2185
    @kristydenali2185 2 ปีที่แล้ว

    Anyway to find certain address and overwrite it and save the file in question without writing to a New file ?

  • @lazarboti4679
    @lazarboti4679 2 ปีที่แล้ว +1

    you are smart thank you

  • @asands123
    @asands123 3 ปีที่แล้ว +1

    You sound like Dracula. Cool.

    • @MyITWorkshop
      @MyITWorkshop  3 ปีที่แล้ว +1

      Thanks, it’s nice to get some appreciation around here. 😀

  • @philtoa334
    @philtoa334 3 ปีที่แล้ว +1

    yes , thanks.

  • @sametozver
    @sametozver 3 ปีที่แล้ว +1

    I want you to share a video about Cisco Serial port(COM) connection.
    please

    • @MyITWorkshop
      @MyITWorkshop  3 ปีที่แล้ว +1

      Hello,
      I did a video in the past where reset the password for a Cisco switch. The way I connected to the device was using a serial port on the switch: th-cam.com/video/CZzq1vRCW98/w-d-xo.html
      Hope it helps
      Thanks for the comment!

    • @sametozver
      @sametozver 3 ปีที่แล้ว

      @@MyITWorkshop Hİ,
      Can you make a serial connection video in python for "cisco switch"?
      ** cisco switch serial connection (COM) for just console cable ==> python connection code
      ** python connection code ==> cisco switch command

  • @mantramusic5009
    @mantramusic5009 2 ปีที่แล้ว +1

    thank you so much

  • @farihamorshed2232
    @farihamorshed2232 2 ปีที่แล้ว

    Thanks its really useful for me. Can you plz help me to find out how to transpose text file in python ?

  • @pamir8337
    @pamir8337 2 ปีที่แล้ว +2

    Very helpful, but the intro gave me a heart attack.

  • @u.mcrafts1714
    @u.mcrafts1714 3 ปีที่แล้ว

    how to direct send export data in text.txt in python

  • @Kalexx46
    @Kalexx46 2 ปีที่แล้ว

    My hero :)

  • @saqibjaseem1957
    @saqibjaseem1957 3 ปีที่แล้ว

    how to modify user input text

  • @thakurharsh4770
    @thakurharsh4770 3 ปีที่แล้ว +1

    Nice Bro

  • @DJFAization
    @DJFAization 3 ปีที่แล้ว

    5:00 "So now that I have a girlfriend, I have to do something with it"

  • @mohamdkazm576
    @mohamdkazm576 3 ปีที่แล้ว +1

    Thank you very much