• Register
Welcome to Kodlogs Q&A, where you can ask programming questions and receive answers from other members of the community. For programmers, by programmers Kodlogs is an open community for anyone that does coding. We help you get answers to your toughest coding questions, share knowledge with your coworkers in private, and find your next IT dream job.

Most popular tags

java program python php javascript c# android python-3 spring r c arrays mysql html spring-boot numpy string exception tomcat macos python-2 eclipse ssl sockets 7 x ssl-certificate entity-framework sql-server matlab redirect code program pip hibernate math security jquery cryptography windows asp list loop int net class https heap-memory garbage-collection quirks-mode internet-explorer-9 internet-explorer machine-learning indentation-error android-studio jupyter-notebook winforms visual-studio-2010 webpack keytool numpy-ndarray aspnet dataframe pandas minecraft jdbc jpa servlet indentation ios typeerror scanner sum deployment loops css util cmd recursion tcp syntax csv float sql number import x509certificate ibm-bpm fatal-error websphere-7 file-permissions file-io accesscontrolexception grizzly atmosphere slick2d lwjgl struts informetica java-applet intellij-idea twitter-bootstrap-3 jax-rs resteasy spring-mvc spring-security-kerberos spring-security kerberos long-integer mapnik pytorch git-review runtime-error vpython continuation homebrew xgboost conda visual-studio android-asynctask stack-trace user-interface jaxws-maven-plugin maven-3 maven-2 browser-notsupportedexception google-maps-api-3 google-maps visual-studio-code truststore apache-spark pyspark firebase-authentication aws-organizations amazon-web-services php-7 string-formatting cplusplus visual-studio-2015 net-core net-mvc msbuild extension-methods foreign-keys sql-server-2005 windows-services react-redux reactjs inputstream facebook-graph-api for-loop entity-framework-4 reportingservices-2005 reporting-services mips linear-regression scikit-learn anova deep-learning keras block-device melt reshape2 floating-point webpack-dev-server javascrip 0-lollipop android-5 statsmodels avx eclipseide javafx-2 php-not-recognized laravel command-line unit-testing tinyurl atom-editor android-emulator android-sdk-tools ionic2 cordova foobar2k tcplistener net-2 net-4 ole-db-provider windows-10 vagrantfile ggplot2 glmnet jvm-arguments global-variables orm virtualenv atom xls oledb redux webclient nio prediction headless hyperlink outlook jackson keystore pipeline illegalstateexception iis jstl encryption perfect-square objective-c carthage xcode8 compiler-errors standard-deviation xampp connector apple mdf destructor vagrant gettime gmail ioexception heuristics milliseconds reporting cpu npm modx-revolution goldsky modx prevnext javascript-dictionary stack-smashing device-monitor radio-button android-actionbaractivity android-activity android-fragments java-long unqualified-id ora-12154 javc c++ java nullpointerexception runtime-error drjava awt-eventqueue dsx math-pow ajquery nosuchelementexception appcompatactivity jtextfield jpanel inputmismatchexception nullpointerexception deque jupyter javafx lvalue junit tensorflow maven simulation ibm factorial javax apache boot opengl virtualbox jvm margins 2147483647 mongodb xcode ubuntu cloud firebase plot processor automation socketexception git crash card certificate pointers concatenation debugging oracle devices module testing color arraylist sequence search date caching expected response directory algorithms release collections facebook figure url expression integer microsoft sorting sort datetime httpwebrequest rest json ajax exe dictionary message required variable time size dll system files runtime function random code file map html5 http version 2
0 votes
13 views
How to use python tostring?
by (8.9k points)  

1 Answer

0 votes
In Python, unlike in JavaScript, or Java, we do not actually have direct function "toString".

You can have it in one or two ways.

1. You can use ```str ( )``` Python function to change/cast the other Python data type to python string,
as:

```
data = 1234
stringData = str(data)
```

2. or you can manually make your own function.
You can do so as in below:

```def toString(data):
        return str(data)
```

That's it.
by (180 points)  
...