Skip to content
  • Facebook
  • GitHub
  • YouTube
  • Pinterest
My Tec Bits
  • Home
  • Microsoft
    • .Net
      • ASP.NET
      • MVC
      • Visual Studio
    • IIS
    • SQL Server
      • SQL Server 2019
      • SQL Server 2017
      • SQL Server 2016
      • SQL Server 2014
      • SQL Server 2012
      • SQL Server 2008
    • Windows OS
  • Web Development
    • Java Script
    • Jquery
    • Python
    • Bootstrap
    • Zurb Foundation
    • Web Security
  • More
    • macOS
    • Reviews
  • Online Tools
    • Fitness Calculators
    • Encoders & Decoders
    • Cryptography
    • Unit Converters
    • Math. Calculators
    • Date & Time Calculators
    • Finance Calculators

Python Tips

Merging two dictionaries in Python

Dec 29, 2022 by Beaulin Twinkle
Merging two dictionaries in Python

Here you will see three simple and commonly used methods in Python programming on merging two dictionaries.

Categories Python Tags Python 3.10.x, Python 3.x, Python Tips Leave a comment

How to sort a dictionary by its value in python?

Dec 2, 2022 by Beaulin Twinkle
Sort a dictionary by its value in python

Python does not have any inbuilt method to sort the dictionary by its value. However, there are a few workarounds. Let’s see one of them.

Categories Python Tags Python 3.10.x, Python Tips Leave a comment

How to import a JSON file to a variable in Python?

Apr 21, 2022 by Beaulin Twinkle
Import A JSON File To A Variable In Python

There are several packages available for Python to import JSON files. I prefer using the pandas. Here is an example to import a JSON file to a variable.

Categories Python Tags Python 3.10.x, Python 3.x, Python Tips, Visual Studio Code Leave a comment

How to import a CSV file to a variable in Python?

Apr 8, 2022 by Beaulin Twinkle
import a csv file to a variable in Python

There are several packages available for Python to import CSV files. I prefer using the pandas. Here is an example to import a csv file to a variable.

Categories Python Tags macOS Big Sur, Python 3.10.x, Python 3.x, Python Tips, Visual Studio Code Leave a comment

How to execute SQL Server stored procedure from Python?

Dec 18, 2020 by Beaulin Twinkle
Execute SQL Server Stored Procedure From Python

Now we will see how to execute a Stored Procedure from python. For the most part, executing a stored procedure is similar to a select statement.

Categories Python, SQL Server Tags Python 3.8.x, Python 3.x, Python Tips, SQL Server 2019 Leave a comment

Adding Key Value Pair To A Dictionary In Python

Sep 24, 2020 by Beaulin Twinkle
Adding Key Value Pair To A Dictionary In Python

How to add key value pair to a dictionary in Python? You can add key value pairs to an existing dictionary by couple of methods. Let us see them in detail.

Categories Python Tags Python 3.8.x, Python 3.x, Python Tips Leave a comment

Check if the list is empty in python

Sep 10, 2020 by Beaulin Twinkle
check if the list is empty in Python

Here is the simple method to check if the list is empty or not in python programming language.

Categories Python Tags Python 3.8.x, Python 3.x, Python Tips Leave a comment

Adding image to Python Django web app

Oct 22, 2019 by Beaulin Twinkle
Adding image to Python Django web app

Adding images and other media files is same as adding other static files. Sometime you may need to segregate images in a separate folder.

Categories Python Tags Django 2.2.x, Python 3.7.x, Python 3.x, Python Tips, Visual Studio Code 4 Comments

How to copy a file in Python?

Oct 3, 2019 by Beaulin Twinkle
copy a file in Python

Here is a simple way to copy a file in Python programming using one of the copy methods in shutil library module.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to get a sub-string from a string in Python

Sep 26, 2019 by Beaulin Twinkle
get a sub-string from a string in Python

There are several ways to get a sub-string from a string in Python programming. Here we will see a simple slicing techniques to get sub string.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to find the current directory of the script file in Python?

Sep 20, 2019 by Beaulin Twinkle
find the current directory of the script file in Python

Here is a simple method to find the current directory of the script file in Python programming using a method from the os module.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

Manually raising exception in Python

Sep 20, 2019Sep 20, 2019 by Beaulin Twinkle
Manually raising exception in Python

Sometime you may need to manually raise exception in Python programming instead of thrown automatically.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

Get the last element of a list in Python

Sep 17, 2019 by Beaulin Twinkle
Get the last element of a list in Python

There are couple of simple ways to get the last element of a list in Python programming. Let us see both these methods with samples.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to find number of elements in a list in Python?

Sep 13, 2019 by Beaulin Twinkle
find number of elements in a list in Python

Here is a simple tip to find the number of elements in a list in Python programming. Get the count of elements in a list.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

Converting string to datetime object in Python

Sep 13, 2019 by Beaulin Twinkle
Converting string to datetime object in Python

Here we will see simple tip to cinvert a string to datetime object in Python programming using the datetime.strptime() method.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to check and parse a string to float in Python?

Sep 11, 2019 by Beaulin Twinkle
check and parse a string to float in Python

To check and parse a string to float, I wrote two simple functions. One of the function checks for float and the other converts the string to a float.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to concatenate multiple lists in Python?

Sep 10, 2019Sep 10, 2019 by Beaulin Twinkle
concatenate multiple lists in Python

There are couple of efficient ways to merge / join / concatenate multiple lists in Python programming. Let’s see how to use them with example.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

How to write data from list to a file in Python?

Sep 6, 2019 by Beaulin Twinkle
write data from list to a file in Python

Here we will see how to write date from list to a file. We will also see a simple technique to write every list element in separate line in the file.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

Reading a file into a list in Python

Apr 8, 2022Sep 5, 2019 by Beaulin Twinkle
Reading a file into a list

Here we will see how to open the file, read the contents to a list variable with a line per list item. Reading a file into a list is quiet simple in python.

Categories Python Tags Python 3.7.x, Python 3.x, Python Tips Leave a comment

Upgrade python version in visual studio code python workspace

Sep 9, 2020Aug 30, 2019 by Beaulin Twinkle
Upgrade Python Virtual Environment

Simple steps to upgrade python version in visual studio code python workspace environment. Upgrading python virtual environment in VS Code.

Categories Python Tags Python 3.7.x, Python 3.8.x, Python 3.x, Python Tips, Visual Studio Code Leave a comment
Older posts
Page1 Page2 Page3 Next →

Article Categories

  • Android (2)
  • Apple (20)
    • macOS (20)
  • Internet & Web Dev. (142)
    • DNN (4)
    • Java Script (10)
    • Jquery (8)
    • PHP (7)
    • Python (73)
    • Twitter Bootstrap (25)
    • Web Security (11)
    • Zurb Foundation (6)
  • Linux (2)
  • Microsoft (292)
    • .Net (64)
    • IIS (10)
    • Internet Explorer (3)
    • Office (2)
    • SQL Server (205)
    • Windows (23)
  • Networks And Distributed Systems (2)
  • Oracle (7)
    • Java (2)
    • Oracle Database (5)
  • Others (4)
  • Reviews (10)

Recent Articles

  • How to make SQL script to sleep? Jan 13, 2023
  • How to make a PHP script to sleep? Dec 30, 2022
  • Merging two dictionaries in Python Dec 29, 2022
  • merge two lists using unpacking method in Python Dec 12, 2022
  • How to sort a dictionary by its value in python? Dec 2, 2022
  • The Benefits and Drawbacks of .NET Development Nov 16, 2022
  • Converting bytes to a string in Python Nov 12, 2022
  • How to prevent connection pool problems between ASP.NET and SQL Server? Oct 27, 2022
  • How to calculate Mode in PHP? Sep 16, 2022
  • How to calculate Median in PHP? Sep 15, 2022

Subscribe MyTecBits.com

Online Tools

  • Fitness Calculators
  • Encoders & Decoders
  • Cryptography
  • Unit Converters
  • Math. Calculators
  • Date & Time Calculators
  • Finance Calculators

Popular Articles

  • SQL Server: Concatenate Multiple Rows Into Single String
  • How to compare contents of two files in Visual Studio Code?
  • How To Get Day Of Week In SQL Server?
  • Getting The List Of Column Names Of A Table In SQL Server
  • SQL Server: Search and Find Table by Name
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use. Learn more...
  • Home
  • About Us
  • Contact Us
  • Site Map
  • Terms Of Use
  • Privacy Policy
© 2012 - 2023 My Tec Bits. All Rights Reserved.