Resolving Checkmarx issues reported
So, here we are using input variable String[] args without any validation…
February 13, 2021
with open(filepath, 'r') as file:
data = file.read()
Above code read whole file at once, but if the files have multiple lines, the result string will have new line characters as well.
This code will gets you a single string as whole content
with open(filepath, 'r') as file:
data = file.read().replace('\n', '')
This code will gets you a single string as whole content
with open('filename') as f:
lines = f.readlines()
Again, this will give new line characters
with open('filename') as f:
lines = [line.rstrip() for line in f]
with open(source_file) as f:
lines = f.read().splitlines()
The best way to open file is with with
keyword, as you do not need to close the file explicitly. It will take care of closing the file handle.
So, here we are using input variable String[] args without any validation…
Introduction In this post, we will see: use Grafana Community Edition (Free…
Introduction We often require to execute in timed manner, i.e. to specify a max…
You can either do tail -f drupal.log or open it in an editor like vim.
Introduction to problem So, on my mac, I’ev set timezone to my local city i.e…
Introduction When I migrated all of my drupal-7 website to drupal-8, I wrote…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…