#denigmacli

1 messages · Page 1 of 1 (latest)

wind oar
viral siren
#
for line in json.loads(req.text)["data"]:
    print(line)
```is equal to```python
print("\n".join(json.loads(req.text)["data"]))
#

Though honestly this is just a suggestion, use whichever code you like better.

wind oar
viral siren
#
def parse_code_file(path):
    form_dict = {}
    with open(path) as file:
        for line in file.readlines():
            form_dict[line] = ""
    return form_dict
```Could also be```python
def parse_code_file(path):
    with open(path) as file:
        form_dict = {line:"" for line in file.readlines()}
    return form_dict
#

With code this simple there isn't really improvements but I prefer dict comprehension in this case

#

It's also a bit faster then just using a traditional for loop