Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to modify __init__ of built-in module directly from the script?
Post: RE: How to modify __init__ of built-in module dire...

For sure it was not my original intention to mess with third-party package source, but what else can you do if you miss functionality? It was exactly my original question, how do I do this directly i...
sonicblind General Coding Help 5 3,593 Jul-31-2018, 12:48 PM
    Thread: Python regex with negative set of characters multiline
Post: RE: Python regex with negative set of characters m...

Ah, damn! the greedy and non-greedy quantifiers, I totally forgot about them. Thanks a lot for the tip and reminder, it works now as expected ;-)
sonicblind General Coding Help 2 3,425 Jul-30-2018, 08:43 PM
    Thread: Python regex with negative set of characters multiline
Post: Python regex with negative set of characters multi...

Hi, I have following text stored as a string: Output:final class myClass1 { const APPLICATION1 = 1; const APPLICATION2 = 2; } final class myClass2 { const APPLICATION3 = 3; const APPLICATION4 = 4; }...
sonicblind General Coding Help 2 3,425 Jul-30-2018, 02:29 PM
    Thread: How to modify __init__ of built-in module directly from the script?
Post: RE: How to modify __init__ of built-in module dire...

Hi, Thanks for a quick reply, however it still does not explain my question. I understand inheritance, at least in the standard form, where child inherits from a parent class, etc. This is all clear ...
sonicblind General Coding Help 5 3,593 Jul-30-2018, 12:13 PM
    Thread: How to modify __init__ of built-in module directly from the script?
Post: How to modify __init__ of built-in module directly...

Hi, I am using a f5-common-python library which I installed with pip. There is a 'asm' directory which has this content: Output:~/.local/lib/python3.6/site-packages/f5/bigip/tm/asm$ attack_types.p...
sonicblind General Coding Help 5 3,593 Jul-26-2018, 12:56 PM
    Thread: How to check if class instance exists in a list of class instance objects?
Post: RE: How to check if class instance exists in a lis...

Thank you all. For my script, these methods are an overkill, but it's good to know the approach and that there is no magic trick to do it easily. I will do it the way Buran suggested when I am not abl...
sonicblind General Coding Help 23 20,439 May-25-2018, 01:50 PM
    Thread: How to check if class instance exists in a list of class instance objects?
Post: How to check if class instance exists in a list of...

Hi, I have a list of class instances: mylist = [ myClass(name=n1), myClass(name=n2), myClass(name=n1), myClass(name=n3) ]How can I get rid of duplicates in this list? I know that the two instances w...
sonicblind General Coding Help 23 20,439 May-25-2018, 10:23 AM
    Thread: How to display XML tree structure with Python?
Post: RE: How to display XML tree structure with Python?

Thanks to all of you for the tips! They helped me to achieve my goal. wavic - My aim was to have no duplicates, so your code was almost perfect, but I reworked it a bit also to include the attribute...
sonicblind Web Scraping & Web Development 13 42,268 Nov-15-2017, 08:34 PM
    Thread: How to display XML tree structure with Python?
Post: RE: How to display XML tree structure with Python?

prettyprint does not help me as it shows everything as is in the XML. That's exactly what I want to avoid. I need no duplicates and no values or attributes. Only the very basic tree structure.
sonicblind Web Scraping & Web Development 13 42,268 Nov-10-2017, 05:26 PM
    Thread: How to display XML tree structure with Python?
Post: How to display XML tree structure with Python?

Hi, I have a large multi-level XML document of a complicated structure, without any namespace definition. I would like to generate a simplified tree view of its structure, so that every possible elem...
sonicblind Web Scraping & Web Development 13 42,268 Nov-10-2017, 03:35 PM
    Thread: Error getting HTTP 200 response with requests.get while wget works fine
Post: Error getting HTTP 200 response with requests.get ...

Hi, I am struggling with smc-python library - frontend to Stonegate API. To create a session with the API I should simply use: session.login(url='http://1.1.1.1:8082', api_key='xxxxxxxxxxxxxxxxx')Wh...
sonicblind Networking 0 5,016 Oct-18-2017, 02:24 PM
    Thread: How to inspect the code of __exit__ method used with 'with' statement?
Post: RE: How to inspect the code of __exit__ method use...

Thanks for your replies! ;)
sonicblind General Coding Help 3 3,396 Oct-18-2017, 01:51 PM
    Thread: How to inspect the code of __exit__ method used with 'with' statement?
Post: How to inspect the code of __exit__ method used wi...

Hi, I am new to Python. I somehow understand the concept about context managers with __enter__ / __exit__ methods, which I can use with 'with' statement. But my issue is that every explanation I coul...
sonicblind General Coding Help 3 3,396 Oct-04-2017, 08:25 AM

User Panel Messages

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