Home > python > Python 3.0 Basics

Python 3.0 Basics

print(“Hello”) prints Hello , to know more about any command use help(<name>) so help(print) brings the command info.

-Unlike older versions python now classifies strings into data and text. All Text is Unicode  represented by type str and all data is encoded Unicode represented as binary data by byte. Both are immutable cannot be inter-converted as in older versions.

-A python script can be written by writing the code in a text file with extension .py Also in Linux / Unix based systems the first line can give the interpreter version
#!/usr/bin/env python        or #!/usr/bin/env python3.0
(If you have multiple versions of python its HIGHLY recommended to stick to 3.x versions)
-Python is strictly indentation based, so give same indentation at each level.

Eg.
i=0                     1
while i<5:              2
print (i)               3
i+=1                    4

So inside the file line 1 & 2 have same indentation while those inside while loop (line 3 &4) have
same indentation but different from outside level.
(To Be Continued ..)
For FAQS and More Info Visit http://docs.python.org/dev/3.0/ or http://docs.python.org/

Advertisements
Categories: python
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: