Posts

Showing posts with the label Concatenate Strings

Featured Post

Python Program: JSON to CSV Conversion

Image
JavaScript object notion is also called JSON file, it's data you can write to a CSV file. Here's a sample python logic for your ready reference.  You can write a simple python program by importing the JSON, and CSV packages. This is your first step. It is helpful to use all the JSON methods in your python logic. That means the required package is JSON. So far, so good. In the next step, I'll show you how to write a Python program. You'll also find each term explained. What is JSON File JSON is key value pair file. The popular use of JSON file is to transmit data between heterogeneous applications. Python supports JSON file. What is CSV File The CSV is comma separated file. It is popularly used to send and receive data. How to Write JSON file data to a CSV file Here the JSON data that has written to CSV file. It's simple method and you can use for CSV file conversion use. import csv, json json_string = '[{"value1": 1, "value2": 2,"value3

2 Best Ways to Concatenate Strings in Python

Image
Concatenation of strings in Python is possible by using the plus and join method. You can also do it in other ways. But in my point of view, these two are the best methods. What are Strings? A string represents in quotes. Let us see the data. It can have all kinds of data. A lot you can do by manipulating strings. Concatenation is one. Example for strings  Stringa='Uncle' Stringb='is' Stringc='Married' Above example, you can see three strings. To make all these strings into a single, you need the concept of concatenation. What is string concatenation? String concatenation is a frequent activity in data science. Knowing this concept is helpful in your project and interviews as well. You can do it using the two best methods. One is you can use plus operator. For the other one, you can use the join method. #1: Using the plus operator Stringa='Uncle' Stringb='is' Stringc='Married' print(Stringa + ' ' + Stringb + ' ' + Stringc)