Now we have forces cause of Look fires on the show version.
Comments include.
We want to comport separate files and collect the waste them and software version.
Then we will create an excel file and at the all
here we want to collect device names inside of greenbacks.
Switch one switch to switch three and switch for and collect softer versions inside red boxes.
But here we have also black boxes.
Same same format as our target.
We will focus on that later.
First we will get regular expression module.
That data frame function from the pandas module.
We use this function to set outputs as three to exact file.
And also we import start to change some stars in that file Tammy create to empty lists for switch names
and so prior version we will use them later.
Here we open a file and collect logs.
After we successfully do it we will add this inside for a open which one takes by untreated string.
All of 252 target characters and finished with a tile side.
So here we write back slash and small letter W and plus inside of parentheses time we write tile side
with parentheses we say that tritone function matches between double could.
But on the print is top part and so it forms right tile side so output will be as W and 1 right here
as W and 1 we do it.
Don't get the dial sine if you remove the this result will be as w 1 and tile side
in the logs.
Maybe there is another letters finish with tile side so to eliminate it to only get the wife's name.
We write names with their practices at zero so we will get the first value in the names list.
We will add or append the value to see which name list which is empty right now.
Now we collect software version we'll write Version 10 digits and plus then not and again digits and
plus that we use parenthesis of true version as we use in switch name.
We only want to get version numbers not to let this off version.
We used three of text slash and it with practice because it looks version shows as parties as a character
like here digits that digit parenthesis digit and parties sort of digits.
That's why we are using the
four.
Here is the deal with conflicts but here you can see why we do too many six patients cancel four of
our And finally we add version zero to soft version list with a punt function.
Now cookies finished for one device but if we do it for many devices to do the same thing we must use
for loop
here with two empty lists in the beginning we add another host list which is the file names of switches
time we have to look.
Here we open text file as switches and we will read it and we will add the comments which find out what
we do in the first site
and print of which name we will like that or software version is like that
finally let us set all of them to the exact file with the timeframe frame function with dictionary for
device name key we had switch name list and for Super virgin key with soft version and we use timeframe
function to create and modify excel file we change with of some final say the excel file
and output we will like that device name so for Virgin and the switch names here and two versions here
let's check in quarter
we have four switches and logs here.
First let's do it for one device in port three from on the import data frame and finally from time frame
import like a frame 16.
That's great to list.
Switch name like hills and police.
And so a.
Anthony
then we open which context like that with open
would it be a reaches it's a close which is a treat.
So we will read that file if you think it's
we're gonna run it now.
This is the switch one log file we created for collated
and we will get to see which name is names variable accused.
I read that fine though and here's to which name you will get.
This one so we can write recurrent like Slash multilateral W which is characters digits or underscore
and plus and we can write bioscience but here we only want to get as W and 1 not diets.
And so we use parenthesis to function just get is value inside and we write string.
If we write names.
Now resolved this is w 1.
If we delete parenthesis
result we'll be including tile.
We had to again
thought names like list is right now is okay.
We got the right result.
And we will let names to which name list append
names
sometimes.
We had some same image in b a many times so we can read names as first value of two names list.
So I pant like that.
So if we print to each name we can just go
without saying it's OK.
Now we can check the version version like yours yet are find all
you go like Virgin cause it will like that
yeah we can copy these women
so we want to get these numbers on the air so we will write Virgin on the point is this
we have some dangerous threat now so backslash the couple of digits maybe it can be so close and we
will get 15 right.
And there is dot here.
You can write back but there is some digits here like slash the
parenthesis but granted quantities means is different in find.
Also we will use parentheses like that first.
We will write back slash granted right now.
So this practice is meaning is different at this current.
This parenthesis is right now just a correct touch just a string right here and backslash T plus because
we have this inside of parenthesis and we will call the contents with backslash and cross part of the
we will run it in x variable which is a
print version
we will get this volume which is correct.
Now let's set Virgin list to soft version is
reconnect with first current first value of these
various rewrite trunk soft version here for us.
If you print soft version
results switch name with correct software version is correct which we can check for seconds switch
to result is OK recursive to reach result.
OK fourth switch without looking.
So now let's create a loop for four devices.
Here we create another list with five names course
one it's
good we have four text file right now it was
let's create for loop Four pi in hosts
from grade 4 Look we must add this in the ID so we will choose all of them and just top two making for
here with open fire No you told me it will be different we will write it open high as switches
if you run it
here switch name and some version to which name some version switch names of Virgin everytime it will
right because from the beginning for loop just check see which one saw it.
Right switch one at in the second took it for like the third loop and for it to go right.
But uh we want to get the final result so we will too late and we exit the loop and we will copy and
write
if we run this we have two lists with switch name and soft version which are correct.
We got the final solution here and and finally we want if we want to write it to excel file we will
we'll start offering here the a variable we create and data frame orientations we create a dictionary
device has a key value bill with which the
being
Virgin key software.
And we can make some tiles in the Excel file personally.
Right.
To recreate it the variable
tile frame well done right there.
We create text exact file
and said We have great sums files frame as a variable is tile frame of the F which is not a frame here.
A self-taught sense Clement would be chest which here.
Columns are a class
got
name and so we really want to hear
and read.
They killed 236
no less write it to excel file and set out to exact function.
Then right there it kills the third
exact right turn.
It's a function
if we run
it great that takes the exact file
here.
We had devised their software version with titles and switches and two versions.
It will create automata plagues that we can do it for many devices for good for loop.
It's very easy to do that.