• Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
  • Login
  • Register
Upgrade
CloudiBee
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
No Result
View All Result
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
No Result
View All Result
CloudiBee
No Result
View All Result
Home Linux

All About Python Raw Input

cloudibee by cloudibee
September 7, 2021
in Linux
0
Python Raw Input
0
SHARES
144
VIEWS
Share on FacebookShare on Twitter

Python is a programming language used in creating software prototypes, data science, web development service, and many others. It is said to be one of the easiest and best paid programming language that anyone can learn. Learning Python is also learning how to use the raw_input function.

Table of Contents

  • What is raw input?
    • You might also like
    • Linux Change Password Command: Change password expiry in Linux
    • Top Open Source Email Servers
  • Here’s an example of using the raw_input function:
  • Now, the output of this command will be like the one below:
  • Comparing raw_input and input functions
  • Example of raw_input function in Python 2
  • Your output should be like this:
  • Another simplified sample of raw_input function in Python 2:
  • Example of raw_input function in Python 3
  • Another simplified sample of raw_input function in Python 3:

What is raw input?

Python raw input is a function that is used to read data from a standard input like the keyboard.  The raw input function mainly works by presenting a prompt to the user, gets answers from the user, and returns the answer by the user.

You might also like

Linux Change Password Command: Change password expiry in Linux

April 7, 2021
Email Servers

Top Open Source Email Servers

September 7, 2021

In Python 3, raw input has been removed and simply replaced, but this still exists in Python 2. In Python 3, this function is now simply called input. So, if you are using the raw input function, you must have Python 2 installed on your computer.

Here’s an example of using the raw_input function:

If you want to ask a user to input their name and then print it, type the command below:

  • a = raw_input(What\’s your name : ‘)

print ‘Username : ‘, a

Now, the output of this command will be like the one below:

  • What’s your name: User’s name

Username: User’s name

Comparing raw_input and input functions

As what is mentioned above, the difference of these two is the version of Python being used. For Python 2, the raw_input function is used to get string input from a user through the command line while the input function is to evaluate the input string.

For the newer version, Python 3, the raw_input function is removed and replaced by the input function, but the function remains the same, to obtain the users through the keyboard. However, the input function in Python 2 has been discontinued, and to obtain the same functionality, users must use or add the “eval (input()) instead in Python 3.

Example of raw_input function in Python 2

  • txt = raw_input(“Type something just to see if this works: “)

print “Is this what you just said?”, txt

Your output should be like this:

  • Type something just to see if this works: test

Is this what you just said? test

Another simplified sample of raw_input function in Python 2:

  • mydata = raw_input(Prompt :’)

print (mydata)

Example of raw_input function in Python 3

  • txt = input(“Type something just to see if this works: “)

print(“Is this what you just said?”, txt

Your output should look like this:

  • Type something just to see if this works: test

Is this what you just said? test

Another simplified sample of raw_input function in Python 3:

  • mydata = input(Prompt :’)

print (mydata)

When you are using Python 2, just remember to use the raw_input function to get the values from the users while being able to use the input function when using the Python 3 version.

With the use of the above code examples, obtaining information from the user is made easy. But, if you are just learning Python programming language, it is best to make use of all available resources from forums and Python communities online.

Tags: PythonPython Raw
Previous Post

Prepare for the Worst: What Nirvanix Teaches Us about Cloud Storage Reliability

Next Post

Self-Service Data Management in a Hybrid IT World

cloudibee

cloudibee

Related Posts

Linux

Linux Change Password Command: Change password expiry in Linux

by cloudibee
April 7, 2021
Email Servers
Linux

Top Open Source Email Servers

by cloudibee
September 7, 2021
Linux

How to Determine Redhat Versions Command

by cloudibee
May 27, 2022
Linux

How-to Linux List Processes in 3 Simple Commands

by cloudibee
May 27, 2022
Linux

What is Cron Job in Linux?

by cloudibee
May 27, 2022
Next Post

Self-Service Data Management in a Hybrid IT World

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Premium Content

Neovise Webinars

May 27, 2022

Scalable Storage without a High-Speed Network — a Neovise Cloud Perspectives Podcast

May 30, 2022
9 Signs Someone Is Using Spyware Against You

9 Signs Someone Is Using Spyware Against You

May 27, 2022

Browse by Category

  • Business
  • Cloud
  • Code
  • Entertainment
  • finance
  • Game
  • Health
  • IT
  • Lifestyle
  • Linux
  • Marketing
  • Misc
  • News
  • SEO
  • Services
  • Splunk
  • Sports
  • Tech
  • Technology
  • Tipes
  • Tips
  • Uncategorized

Browse by Tags

algorithm Apache Apache2 AWS Bash bash history Bind Blacklists Buffer C C++ CentOS Cerner chage Cloud Cloud Computing Cloud jobs Cloud Storage Cloud Suite Commands Compliance Cron job Debian Directory DMS DNS Docker Dovecot drop cache Email servers Enteprise Cloud Enterprise External FAT32 Format kernel Linux linux kernel Nirvanix passwd Sendmail SSH SSL Terminal Ubuntu

About CloudiBee

cloudibee logo


CloudiBee is an open-source for people who love technology. Here we will be sharing lots of technical information over the web so that a lot of people visit us and gain some knowledge. We are a completely open to all platform. We assure you that you can easily get any info and updated news about the tech world from us. Let's begin with us!

Hot Topic

Gift Flowers as a Token of Appreciation

by mindmingles
July 26, 2022
0
Flowers

Flowers are unquestionably the best gift to give to loved ones. It can express feelings that most people forget to...

Read more

Recent News

Business

5 tips to ensure that your movers are always on time.

July 21, 2022
Tips

Flake ice machine for all who want to grow

July 18, 2022
Technology

Launching Progressive Web Applications on App Stores in 2022

July 16, 2022

CloudiBee. © 2021. All Rights Reserved

No Result
View All Result
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk

CloudiBee. © 2021. All Rights Reserved

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In