Scripting with Python - Modify a TXT file

  Рет қаралды 51,373

My IT Workshop

My IT Workshop

Күн бұрын

Пікірлер: 33
@ericholland_LTD
@ericholland_LTD Жыл бұрын
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 жыл бұрын
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 жыл бұрын
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())
@exonoia
@exonoia 3 жыл бұрын
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
@arpsri9675
@arpsri9675 10 ай бұрын
This video is my "GOD" , thank you so much
@hymavathipaladugu4404
@hymavathipaladugu4404 3 ай бұрын
the hello it pros fot me🤣 But the rest of the vid is fire
@CharJlJly
@CharJlJly 2 жыл бұрын
thanx a LOT, man. You are wizzard from other planet
@eliehaddad84
@eliehaddad84 2 жыл бұрын
Extreme good explanation 👍🏼
@shrikantagashe9449
@shrikantagashe9449 2 жыл бұрын
Thank you man for saving my day 🙌🙌
@manishmurari6494
@manishmurari6494 3 жыл бұрын
Explained really good...thank you
@maxwellsalmon5160
@maxwellsalmon5160 3 жыл бұрын
Legend, thank you.
@debanjansen1282
@debanjansen1282 3 жыл бұрын
Extremely good tutorial
@tendinginfinity
@tendinginfinity 3 жыл бұрын
Great man looks like i understand all thank you so much 👌👌👌👌👌👌
@xerogaming2127
@xerogaming2127 3 жыл бұрын
How can we save data in key value type way , for example saving a conversation between two people ?
@kristydenali2185
@kristydenali2185 2 жыл бұрын
Anyway to find certain address and overwrite it and save the file in question without writing to a New file ?
@Kalexx46
@Kalexx46 2 жыл бұрын
My hero :)
@asands123
@asands123 3 жыл бұрын
You sound like Dracula. Cool.
@MyITWorkshop
@MyITWorkshop 3 жыл бұрын
Thanks, it’s nice to get some appreciation around here. 😀
@jadkhalil9263
@jadkhalil9263 Жыл бұрын
Thanks very good video
@lazarboti4679
@lazarboti4679 3 жыл бұрын
you are smart thank you
@pamir8337
@pamir8337 3 жыл бұрын
Very helpful, but the intro gave me a heart attack.
@farihamorshed2232
@farihamorshed2232 2 жыл бұрын
Thanks its really useful for me. Can you plz help me to find out how to transpose text file in python ?
@civil3dsimplified64
@civil3dsimplified64 2 жыл бұрын
Can we use "import os" instead "with open method"? And thanks for over simplification of these concepts
@philtoa334
@philtoa334 3 жыл бұрын
yes , thanks.
@mohamdkazm576
@mohamdkazm576 3 жыл бұрын
Thank you very much
@sametozver
@sametozver 3 жыл бұрын
I want you to share a video about Cisco Serial port(COM) connection. please
@MyITWorkshop
@MyITWorkshop 3 жыл бұрын
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: kzbin.info/www/bejne/eYvdomSsh6iKb5o 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
@saqibjaseem1957
@saqibjaseem1957 3 жыл бұрын
how to modify user input text
@u.mcrafts1714
@u.mcrafts1714 3 жыл бұрын
how to direct send export data in text.txt in python
@thakurharsh4770
@thakurharsh4770 3 жыл бұрын
Nice Bro
@DJFAization
@DJFAization 3 жыл бұрын
5:00 "So now that I have a girlfriend, I have to do something with it"
@mantramusic5009
@mantramusic5009 3 жыл бұрын
thank you so much
Automation Using Python | Press "F5" key with a Script
11:20
My IT Workshop
Рет қаралды 7 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 208 М.
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,8 МЛН
Automate Excel With Python - Python Excel Tutorial (OpenPyXL)
38:02
Tech With Tim
Рет қаралды 1,6 МЛН
How to Read/Write to Txt File With Python | Handle Text Files in Python
13:57
Fabio Musanni - Programming Channel
Рет қаралды 2 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
Python GUI open a file (filedialog) 📁
7:38
Bro Code
Рет қаралды 100 М.
Automate Boring Office Tasks with ChatGPT and Python
10:06
Coding Is Fun
Рет қаралды 525 М.
THIS Is The Best & Safest Way To Open Files In Python
6:57
Indently
Рет қаралды 36 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН