Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, August 23, 2023

python substring output "jkl-mno-test" from string "abc:def:ghi::jkl-mno-test"

python substring output "jkl-mno-test" from string "abc:def:ghi::jkl-mno-test" To extract the substring "jkl-mno-test" from the string "abc:def:ghi::jkl-mno-test" in Python, you can use slicing. Here's how you can do it:
original_string = "abc:def:ghi::jkl-mno-test"
substring = original_string.split("::")[-1]
print(substring)
In this code, split("::") breaks the original string into parts using "::" as the delimiter and returns a list of parts. Since you're interested in the last part, you can use [-1] to access the last element of the list, which will be "jkl-mno-test". The output will be:
jkl-mno-test

Tuesday, October 18, 2022

PyCharm Location

Pycharm Location 1. C:\Users\{username}\AppData\Roaming\JetBrains\PyCharm2020.2\eval --> evaluation key R 2. C:\Users\{username}\AppData\Roaming\JetBrains\PyCharm2020.2\options --> others.xml R

Wednesday, September 28, 2022

Python Cheatsheet

1. End users can download and install any package into their Python environment. Typically this is done with pip, using a command like:
python3 -m pip install package-name
2. Uninstall Packages
python -m pip uninstall package-name
3. List Installed Packages
python -m pip list
and
python -m pip freeze

Saturday, August 14, 2021

Palindrome Number in Python(With Code)

 What is palindrome Number?

A palindromic number is a number (such as 16461) that remains the same when its digits are reversed.

 Python Code:

 

Resource Link:   

  1. https://en.wikipedia.org/wiki/Palindromic_number
  2.  https://github.com/rizvi/python-tpoint/blob/master/Palindrome.py