Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Exporting to Excel
Post: RE: Exporting to Excel

can we remove the section after "_ " in "endpoint"and export that to excel ? for e:g rd2ff5-az2-1519-1520_eth1-18_vpc needs to be "rd2ff5-az2-1519-1520" ?
Nirmal General Coding Help 5 2,688 Aug-08-2019, 12:22 PM
    Thread: Exporting to Excel
Post: RE: Exporting to Excel

well its like value against each item ... so its in dictionary..
Nirmal General Coding Help 5 2,688 Aug-08-2019, 10:38 AM
    Thread: Exporting to Excel
Post: RE: Exporting to Excel

@Nuzvee : this says : ----> 2 endpoint = list[1].split('-') 3 print endpoint AttributeError: 'dict' object has no attribute 'split'it says this too : TypeError: unhashable type
Nirmal General Coding Help 5 2,688 Aug-08-2019, 09:24 AM
    Thread: Exporting to Excel
Post: Exporting to Excel

i am trying to Export the data to excel list = [{'ip': u'9.11.180.3','endpoint': u'rd2ff5-az2-1519-1520_eth1-18_vpc', 'hostname': u'RD2APIC1', 'encap': u'vlan-42', 'epg': u'19_14_140_172', 'extpaths'...
Nirmal General Coding Help 5 2,688 Jul-26-2019, 05:00 PM
    Thread: Data alignment in Python
Post: Data alignment in Python

I am new to Python . I am writhing a code to generate a excel file having the data sourced by calling API and correlate those to get desired result. basically taking input from one database and searc...
Nirmal General Coding Help 1 2,590 Feb-11-2019, 08:49 AM
    Thread: Rearranging elements in Python
Post: RE: Rearranging elements in Python

This worked perfectly ..THANK YOU
Nirmal General Coding Help 10 5,019 Nov-23-2018, 12:05 PM
    Thread: Rearranging elements in Python
Post: RE: Rearranging elements in Python

its saying "invalid Syntax " -- print('/'.join(str(x) for x in rec), file=fw1)
Nirmal General Coding Help 10 5,019 Nov-23-2018, 03:28 AM
    Thread: Rearranging elements in Python
Post: RE: Rearranging elements in Python

i have a script and i think we can achieve the objective but i am missing somewhere ? with open("abc1.txt", "w+") as fw1, open("abc2.txt", "w+") as fw2: for i in p: if len(i.partition("/"...
Nirmal General Coding Help 10 5,019 Nov-22-2018, 11:08 AM
    Thread: Rearranging elements in Python
Post: RE: Rearranging elements in Python

This one i am also getting but i need to define the range in abc2.txt 101/1/1-3 102/1/1-3 103/1/1-4 104/1/1-4
Nirmal General Coding Help 10 5,019 Nov-22-2018, 09:53 AM
    Thread: Rearranging elements in Python
Post: RE: Rearranging elements in Python

Hey , i tried below p = ['Eth1/1', 'Eth1/48','Eth2/1', 'Eth2/4','Eth101/1/1', 'Eth101/1/16', 'Eth101/1/3','Eth102/1/1', 'Eth102/1/2', 'Eth102/1/3','Eth103/1/1', 'Eth103/1/2', 'Eth103/1/3','Eth103/1/...
Nirmal General Coding Help 10 5,019 Nov-22-2018, 09:19 AM
    Thread: Rearranging elements in Python
Post: Rearranging elements in Python

i am new to Python and i cant get this.I have a List and i want to take the input from there and write those in files . p = ['Eth1/1', 'Eth1/5','Eth2/1', 'Eth2/4','Eth101/1/1', 'Eth101/1/2', 'Eth101/...
Nirmal General Coding Help 10 5,019 Nov-22-2018, 06:26 AM
    Thread: Python Pexpect - SSH Timeout
Post: RE: Python Pexpect - SSH Timeout

Got to know its getting failed here... def macGrabber(child,switch,cat = False): try: if cat is False: child.expect('.#') child.sendline('sh mac address-table | no...
Nirmal Networking 3 6,754 Oct-17-2018, 01:08 PM
    Thread: Python Pexpect - SSH Timeout
Post: Python Pexpect - SSH Timeout

Hi I am using Pexpect module to make SSH connection but it is falling into Traceback and exits. Any idea how to fix it . I have tried multiple post that already exist in StackOverflow and other ...
Nirmal Networking 3 6,754 Oct-16-2018, 11:11 AM
    Thread: List comparison in Python
Post: RE: List comparison in Python

i did research and manage to match list index[1] .. could not do for list index[2] and index[3] c = [o for o in a if o[1] not in [n[1] for n in b]] print ccan we do similar match for o[2] and o[3] ....
Nirmal General Coding Help 4 3,041 Sep-26-2018, 01:54 PM
    Thread: List comparison in Python
Post: List comparison in Python

HI I have two list . i want to compare with each other with the list index[1][2][3] of each list with other list .If its a match then ignore , if not the return the whole list. a = [['Eth1/1/13',...
Nirmal General Coding Help 4 3,041 Sep-26-2018, 09:33 AM
    Thread: New .txt file Generation in Python
Post: New .txt file Generation in Python

I want to create a new .txt file every time i run the python script. Any idea how to do that . My current code : def write_up_commands(up_int): fp = open('./abc.txt', 'a+') for i in up_int: ...
Nirmal General Coding Help 1 2,536 Sep-10-2018, 12:08 PM
    Thread: Exporting Python Output to Notepad
Post: RE: Exporting Python Output to Notepad

i was returning the output to list before it was getting written in .txt..fixed that.. thanks
Nirmal General Coding Help 4 3,517 Sep-02-2018, 02:36 PM
    Thread: Exporting Python Output to Notepad
Post: RE: Exporting Python Output to Notepad

i m not getting any error..but i dont see that file.Running exactly the same code and i am login to root... i tried 10:57:03 # find . -name command_file.txt no luck....
Nirmal General Coding Help 4 3,517 Aug-28-2018, 04:01 PM
    Thread: Exporting Python Output to Notepad
Post: Exporting Python Output to Notepad

Hi i am trying create a file in Python 2.6.6. Its working in Python 2.7 fp = open('command_file.txt', 'w') fp.write(device1 + '#' + intstatus + '\n' + device1 + '#\n') command_file.txt is not b...
Nirmal General Coding Help 4 3,517 Aug-28-2018, 03:18 PM
    Thread: Converting String into Nested List
Post: Converting String into Nested List

I have a nested list . i Need to reorganize it. Expected Output : [['Eth1/1,1,eth,f-path,down,Channel,admin down,10G(D),1'],['Eth102/1/15,10,eth,trunk,down,Administratively down,auto(D),--']]Current...
Nirmal General Coding Help 1 2,810 Aug-25-2018, 01:19 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020