Home > Enterprise >  How to change python code formatting so that a single statement fits in one line, rather than being
How to change python code formatting so that a single statement fits in one line, rather than being

Time:11-24

I need to fetch all the Django ORM queries used in my project.

I have written a script that goes through the project files and writes the matching LOC to a CSV. The problem is that some of these queries are written in multiple lines to improve readability, which is causing my logic to fail and give me incomplete results in the CSV.

Does anyone have an idea how to remove the code formatting to make a single python statement fit in one line so that I can execute my script successfully?

CodePudding user response:

you can chain f strings together then use the \ to add all the strings in the next line.

similar to this

body = f"Hello {first_name},<p>Thank you for your score.</p>\
<p>We are happy to inform you that we have resolved the error.</p>\
<p>Login to the app and check now.</p>\
<p>Sincerely,<br>\
Team </p>"

CodePudding user response:

Do you Mean You've Database logs and trying to seperate each diff query? Can u share some queries,maybe i have done similar if i'm not wrong

  • Related