Python
Reading and Writing CSV Files in Python using CSV Module & Pandas
What is a CSV file? A CSV file is a type of plain text file that uses specific structuring to...
In this tutorial, you will learn-
More often then not you require to Print strings in your coding construct.
Here is how to do it in Python 3
Example: 1
To print the Welcome to Guru99, use the print () function as follows:
print ("Welcome to Guru99")
Output:
Welcome to Guru99
In Python 2, same example will look like
print "Welcome to Guru99"
Example 2:
If you want to print the name of five countries, you can write:
print("USA") print("Canada") print("Germany") print("France") print("Japan")
Output:
USA Canada Germany France Japan
Sometimes you need to print one blank line in your Python program. Following are an example to perform this task.
Example:
Let us print 8 blank lines. You can type:
print (8 * "\n")
or:
print ("\n\n\n\n\n\n\n\n\n")
Here is the code
print ("Welcome to Guru99") print (8 * "\n") print ("Welcome to Guru99")
Output
Welcome to Guru99 Welcome to Guru99
By default, python's print() function ends with a newline. This function comes with a parameter called 'end.' The default value of this parameter is '\n,' i.e., the new line character. You can end a print statement with any character or string using this parameter. This is available in only in Python 3+
Example 1:
print ("Welcome to", end = ' ') print ("Guru99", end = '!')
Output:
Welcome to Guru99!
Example 2:
# ends the output with '@.'
print("Python" , end = '@')
Output:
Python@
What is a CSV file? A CSV file is a type of plain text file that uses specific structuring to...
What is JSON? JSON is a standard format for data exchange, which is inspired by JavaScript....
Python List data-type helps you to store items of different data types in an ordered sequence. The...
Python is one of the most popular programming languages. Currently, each of the following six...
What is PyTest? PyTest is a testing framework that allows users to write test codes using Python...
What is XML? XML stands for eXtensible Markup Language. It was designed to store and transport...