'how to set area name base on store name from database dynamically in url in asp core
how to change area name based on my store name dynamically like localhost:7073/mystorename/controller/view this type of url I am save my store name into database how to show my store name in database to url
Solution 1:[1]
I understand your problem and maybe I know how to help you.
I let you here a python3 snippet that I made:
import re
import subprocess
def format_output(output, regex=None):
assert type(output)==list, 'the output parameter need to be a list'
if not regex:
output.pop()
return output
data = list()
pattern = re.compile(regex)
for line in output:
match = pattern.search(line)
if match:
if pattern.groups > 0:
set = list()
for i in range(0, pattern.groups):
if match.group(i + 1) is not None:
set.append(match.group(i + 1))
data.append(set)
else:
data.append(line)
return data
def shell_output(command, regex=None):
output = subprocess.check_output(command)
lines = output.decode().split('\n')
return format_output(lines, regex)
Using the command find( shell_output("find")) you will get a list containing the splitted find's command output, adding the regex parameter allows you to filter results.
You can make a perfect regex to find only the files that do NOT contain what you want to include in the clean
Once you find it, close the script with:
trash= shell_output("find", *YOURREGEX)
for stuff in trash
os.system("rm"+stuff)
And you finally have your Cleaner ;)
Here you will find the documentation for making your regex: https://docs.python.org/3/howto/regex.html
PS: find command work on linux if you are on windows use a command for recursive directory listing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | alex longo |
