Lets-Encrypt SSL Certificate Useful Commands
You might need to put sudo before above command. The command will show details…
May 14, 2019
This post some useful tips of using strings, and some issues while dealing with strings
Hope, you have seen Python string format
to_search = 'my_name'
my_var = 'my_name_is_gorav'
if my_var.startswith(to_search):
print('Found')
Example, you have a string:
my_var = 'Name:GyanBlog'
You want to have anything after colon
name = my_var.split(':')[1]
Example: You have some long string like:
name = 'SERVICE_CLOUD_ACCOUNTS'
And, I want something like:
ServiceCloudAccounts
Then, use this code:
new_name = name.title().replace('_', '')
title() method will give you ServiceCloudAccounts, then we have to remove any other characters we want
my_str.strip()
Your string has multiple spaces in between, and you want to convert them into one only.
import re
s = 'hey, i have multiple spaces'
re.sub("\s+", " ", s);
# Output
'hey, i have multiple spaces'
It works perfectly find with following cases
print('{hi}')
print('{hi} %s' %('hi'))
But, not with
website='GyanBlog.com'
print(f'hi { {website} .com}')
You have to use Double Curly-braces
website='GyanBlog.com'
{% raw %}
print(f'hi {{ {website} .com}}')
{% endraw %}
s = 'GyanBlog'
s[1:]
#Output: yanBlog
s = 'GyanBlog'
s[:-1]
You might need to put sudo before above command. The command will show details…
Introduction Often in automation, we need to install stuff from command line…
One of the biggest task while writing article or blog is to have right set of…
Introduction In this tutorial we will see: How to instantiate different classes…
While running docker commands with some images, I started getting error: The…
Tag the image, by seeing its image id, from docker images command docker tag 04d…
Introduction Strapi is a backend system provides basic crud operations with…
Introduction I had to create many repositories in an Github organization. I…
Introduction I was trying to download some youtube videos for my kids. As I have…
Introduction In this post, we will explore some useful command line options for…
Introduction In this post, we will see how we can apply a patch to Python and…
Introduction We will introduce a Package Manager for Windows: . In automations…