Try this:
#!/usr/bin/env python
# Filename : stringvar.py
# Description : A simple example that shows how to assign a string to a variable
# Author : Obispo
str="Hello World!"
print "str = ", str
Output:
# ./stringvar.py
str = Hello World!
That's it! The code is so straight forward. Luckily python is not like any other programming language wherein you need to define the data type of your variable first before assigning value into it.
No comments:
Post a Comment