Non-strings and strings


Can someone explain me why we have to use srt() to convert non-strings into strings? Wold not be the same if insted of that we just add the "..".
Like: 6=str(6)="6"

Replace this line with your code.


but what if you integer is stored in a variable?


You're saying like this:

print " hi, my friends"

the output would be "6, my friends"?


no, i am saying you can't just put "" around hi, given it then will just be read as string, not a string version of the integer


Can you tell me what is the difference between been "read as string" and "string version of the integer"?


hiStr = str(hi)

hiStr is now contains "6", a string. Strings are pieces of information between qoutation marks, so 6 is an integer, "6" is a string


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.