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!!
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())
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
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!
@@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
the hello it pros fot me🤣
But the rest of the vid is fire
Oh my gosh thank you so much I had all the code written and no idea how to put it in a new file
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!!
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())
This video is my "GOD" , thank you so much
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
Thank you man for saving my day 🙌🙌
thanx a LOT, man. You are wizzard from other planet
Extreme good explanation 👍🏼
Explained really good...thank you
Great man looks like i understand all thank you so much 👌👌👌👌👌👌
Legend, thank you.
Extremely good tutorial
How can we save data in key value type way , for example saving a conversation between two people ?
Thanks very good video
Can we use "import os" instead "with open method"?
And thanks for over simplification of these concepts
Anyway to find certain address and overwrite it and save the file in question without writing to a New file ?
you are smart thank you
You sound like Dracula. Cool.
Thanks, it’s nice to get some appreciation around here. 😀
yes , thanks.
I want you to share a video about Cisco Serial port(COM) connection.
please
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!
@@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
thank you so much
Thanks its really useful for me. Can you plz help me to find out how to transpose text file in python ?
Very helpful, but the intro gave me a heart attack.
how to direct send export data in text.txt in python
My hero :)
how to modify user input text
Nice Bro
5:00 "So now that I have a girlfriend, I have to do something with it"
Thank you very much