and thank you for taking the time to read this post. This is literally my first time trying to use Python so bare with me. My Target/Goal: Edit the original text file (Original .txt file) so that for every domain listed an “OR” is added in between them (below target formatting image). Any help is greatly appreciated. I have been
Tag: scripting
subprocess popen is returning blanck output
On trying to run the grep for the output of previous command using popen returning blank without any error output i got: Answer You don’t need to concoct a pipeline of kubectl + grep here.
Optimising Python script for scraping to avoid getting blocked/ draining resources
I have a fairly basic Python script that scrapes a property website, and stores the address and price in a csv file. There are over 5000 listings to go through but I find my current code times out after a while (about 2000 listings) and the console shows 302 and CORS policy errors. As you can see I added sleep(randint(1,
Obfuscate file name and folder path
I am working on a git repo and I need to share folder hierarchy and file names to external vendor to perform some code analysis. I have whole hierarchy available in a csv file. Problem is that I cannot provide actual folder paths or file names as they contain protected information. For code analysis, external vendor only needs folder paths
Accessing a specific instance of Enterprise Architect via COM from Python
A running instance of EA can be accessed from a Python script with something like: However, this seems to always returns the COM object of the instance first started. Let’s say we have a script that needs to starts a new instance of EA. It does so by calling os.startfile(eapxFile) with eapxFile being the path to an empty EA file.
Automatically call common initialization code without creating __init__.py file
I have two directories in my project: “src” contains my polished code, and “scripts” contains one-off Python scripts. I would like all the scripts to have “../src” added to their sys.path, so that they can access the modules under the “src” tree. One way to do this is to write a scripts/__init__.py file, with the contents: This works, but has