Python Forum
string function doesn't work in script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string function doesn't work in script
#1
I don't know if this has been posted before, but when I run the string function in interactive, it works fine, but when it comes to script it doesn't work. Here is my code:
print(str(24))
Why is that?
Reply
#2
How is it not working? What do you mean by "when it comes to script it doesn't work"?

There is no need to use the explicit str() function. Print automatically does the conversion for you.
ClockPillow likes this post
Reply
#3
(Jul-13-2021, 02:08 PM)deanhystad Wrote: How is it not working? What do you mean by "when it comes to script it doesn't work"?

There is no need to use the explicit str() function. Print automatically does the conversion for you.

Yeah you're right. I was confused as there were no quotations over the number to indicate that it was a string. Thank you.
Reply
#4
Any quotes surrounding a string is a feature of your development environment, not Python. Remember that what you see printed is only a representation of the thing, not the thing itself, and that the representation is just somebody's idea of the best representation.
ClockPillow likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Script stop work after 3 actioins - PLEASE WHERE IS THE PROBLEM? rondon442 0 101 Sep-27-2021, 05:40 PM
Last Post: rondon442
  Psycopg2 doesn't work with python2 MedianykEugene 3 345 Aug-10-2021, 07:00 AM
Last Post: ndc85430
  write new function or change the old one to work "smartter? korenron 3 251 Aug-09-2021, 10:36 AM
Last Post: jamesaarr
  UART Serial Read & Write to MP3 Player Doesn't Work bill_z 15 891 Jul-17-2021, 04:19 PM
Last Post: bill_z
Photo Windows 10 PowerShell doesn't work Amy 3 1,366 Apr-27-2021, 01:33 PM
Last Post: jefsummers
  Passing flags to python script, through a function xbit 4 799 Apr-20-2021, 06:32 AM
Last Post: ndc85430
  Why doesn't this print statement work? stylingpat 10 1,321 Mar-23-2021, 07:54 PM
Last Post: buran
  keyboard module doesn't work in the microsoft version terminal of python. username 1 702 Feb-25-2021, 05:19 PM
Last Post: Larz60+
  pygame music doesn't work CompleteNewb 1 1,927 Jan-30-2021, 09:25 AM
Last Post: Tyrel
  Curses script doesn't work wavic 1 891 Jan-08-2021, 09:11 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020