iTechtalk

Quick Search

Go Advanced

Member Login

Not registered? | Forgot Password
 
Register
Welcome
 
iTechtalk > Tutorials > Programming » The del Statement in Python
Reply
Old 11-04-2008, 09:26 AM   #1 (permalink)
 
achiever's Avatar
 
Junior Member
Join Date: Nov 2008
Posts: 15
Post The del Statement in Python

The del Statement in Python:-

The remove method removes a specific item from a list, if that item is in the list. Some situations might require that you remove an element from a specific index, regardless of the item that is stored at that index. This can be accomplished with the del statement. Here is an example of how to use the del statement:

my-list = [l, 2, 3, 4, 5]

print 'Before deletion:’, my-list

del my-list [2]

print 'After deletion:', my-list

This code will display the following:

Before deletion: [1, 2, 3, 4, 5]

After deletion: [1, 2, 4, 5]
achiever is offline   Reply With Quote
 
Reply

Bookmarks

Tags
del statement, python

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The switch statement in C++ Programming dil se Programming 0 01-09-2009 04:11 AM
The if statement in C++ Programming prem Programming 0 12-01-2008 10:11 AM
Using if Statement to Test a Condition in Flash bunty Graphics 0 11-12-2008 10:15 AM
IDLE in Python independent Programming 0 11-06-2008 09:20 AM
The ‘import’ Statement in Java genius Programming 0 10-06-2008 11:14 AM


 

Content Relevant URLs by vBSEO 3.3.0