It is currently 27 Oct 2021, 07:45

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | 🡆 Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP
Sponsored content for World Food Program

What is the opposite of str(x)? To make a string a number?

Asks Python related questions here
tim
GL Blogger
1st Place
5571 Post(s)

What is the opposite of str(x)? To make a string a number?

Post#1 by tim » 11 Nov 2018, 15:16


Asked by Krikor here.

The opposite function of str() that converts string back to integer is int(). Syntax is int(YOUR_STRING)
for example
my_int = int("10")
now my_int will be holding the numeric value of 10.

There is also a function to turn string back into a float (real number with decimals) called float(). Syntax is float(YOUR_STRING)
for example
my_float = float("10")
now my_float will be holding the numeric value of 10.0
aka Tin
World Food Program | Good Deeds Forum

         


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | 🡆 Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests