[Solved] How to fix pycharm Environment error while installing new packages [closed]

no (at least not automagically … ) Install python … install packages … make venv’s using –include_site_packages (pycharm makes this quite easy with their GUI create new venv thing) I think you must have some globally installed python that you can create venvs from pip is the python package manager, this is how you install … Read more

[Solved] Python regex – check String for nested loops

Based on @Kevin s suggestion with “ast.parse“ I could use def hasRecursion(tree): for node in [n for n in ast.walk(tree)]: nodecls = node.__class__ nodename = nodecls.__name__ if isinstance(node, (ast.For, ast.While)): for nodeChild in node.body: #node.body Or ast.iter_child_nodes(node) if isinstance(nodeChild, (ast.For, ast.While)): return True return False expr=””” for i in 3: print(“first loop”) for j in … Read more

[Solved] regex, search a few letter in one word [closed]

You may try using the regex pattern l.*t.*e, e.g. my_str = “little” if re.match(r’l.*t.*e’, my_str): print “MATCH” More generally, if you want to find l..t..e within a single word, then try: my_str = “little” if re.match(r’\b\w*l.*t.*e\w*\b’, my_str): print “MATCH” 2 solved regex, search a few letter in one word [closed]

[Solved] How to fix ‘\n’ from json?

Assuming your data object is a simple dict or list,all you need to do is: with open(output_path, ‘w’) as f: json.dump(data, f, sort_keys=True, indent=4) This will correctly dump to the output file. 3 solved How to fix ‘\n’ from json?

[Solved] combining two json strings without ” or ‘

You shouldn’t try to manipulate them as strings – this will be fragile and very specific to the strings. Instead, parse the strings into dictionaries, do whatever manipulations you want, and then dump them back to JSON strings: import json s1 = ‘{“step”:”example step”, “data”:”example data”, “result”:”example result”}’ s2 = ‘{“attachments”:[ { “data”:”gsddfgdsfg…(base64) “, “filename”:”example1.txt”, … Read more

[Solved] ‘NoneType’ object has no attribute ‘get’ when the object is not type None [closed]

Welcome to StackOverflow! It appears your variable: mf_json_data defined at: https://github.com/apalmesano2/assignment2_part2/blob/master/portfolio/models.py#L113 is failing to return a value, resulting in mf_request = None. I recommend you ensure your mf_json_data = requests.get(mf_url).json() is pulling appropriately. Try debugging with something like this: mf_request = requests.get(mf_url) print(‘MF Request:’, mf_request, ‘MF Request Type: ‘, type(mf_request)) if mf_request.status_code != 200: print(‘Bad … Read more

[Solved] What is the process of this program written in Python?

It seems you are new to the world of programming. “sys.argv” is used to take Command Line Arguments. when you run as “python sample.py”, the variable sys.argv will be a single element list i.e. [“sample.py”] len(sys.argv) is 1 in this case The Expected Working of the program is: when you run as “python sample.py fileToRead.txt”, … Read more

[Solved] Updating asp.net JPG File

If you don’t want to refresh the page manually, you can add the following meta tag to your tag that will refresh it automatically. <meta http-equiv=”refresh” content=”5″> The above meta tag will refresh the page every 5 seconds. 3 solved Updating asp.net JPG File

[Solved] xpath issue in extracting data [duplicate]

you can also use split() function to do your task str=”published = 6/11/2019 at 8:02 AM” str=str.split(‘=’) str=str[1].split(‘at’) print(‘published date=”,str[0],”\npublished time=”,str[1]) you will get the same result 2 solved xpath issue in extracting data [duplicate]

[Solved] Write a Python program to guess a number between 1 to 9

OP: i have written code but it hangs after giving input.. after ctr+c it shows last call on if statement. Because: Imagine you’ve entered an incorrrect number, the condition fails, the loop continues, it checks the same condition and fails again, keeps going on and on. What you need: Put the ug = int(input(“Guess a … Read more

[Solved] How do I add ‘if’ commands inside a ‘why’ loop [closed]

It is because the if statement is not indented properly and its condition is not specified as a string ‘help’: while 1: userCommand = input(‘Type a command (type \’help\’ for syntax): ‘) if userCommand == ‘help’: print (‘flight: this command will be used to list a flight’) break solved How do I add ‘if’ commands … Read more

[Solved] How to iterate over JSON array? [closed]

Use the json package and load the json. Assuming it is a string in memory (as opposed to a .json file): jsonstring = “”” [ { “issuer_ca_id”: 16418, “issuer_name”: “C=US, O=Let’s Encrypt, CN=Let’s Encrypt Authority X3”, “name_value”: “sub.test.com”, “min_cert_id”: 325717795, “min_entry_timestamp”: “2018-02-08T16:47:39.089”, “not_before”: “2018-02-08T15:47:39” }, { “issuer_ca_id”:9324, “issuer_name”:”C=US, O=Amazon, OU=Server CA 1B, CN=Amazon”, “name_value”:”marketplace.test.com”, “min_cert_id”:921763659, … Read more

[Solved] How would i create a regex for the following [closed]

As I understand, the number of groups in a regex pattern is pre-determined. If you need to iterate over all the matches, you could do something like this: import re text = “””some value {arg1} {arg2} {arg3} another value {arg1} idkhere {arg1} {arg2}””” pattern = re.compile(r”{arg\d}”) for i in re.findall(pattern, text): print(i) 2 solved How … Read more