Questions tagged [del]

Short for delete, this is a keyword/command/function that deletes objects (Python, et al.) or files (Windows/DOS cmd / batch).

Short for delete, this is a command/keyword that deletes... - files in Windows cmd (command prompt) / batch. Another equivalent to this is the erase command, also in cmd / batch. - a keyword/function name in Python and various languages and software libraries, that deletes objects - also often used in other places to denote a deletion operation - a key on the keyboard

313 questions
-2
votes
2 answers

Error when trying to pop KV pair from dictionary in loop

I have a dictionary that looks like so: {'1A': {'White Bread loaf large': 1, 'Brown Bread loaf large': 1, 'Skimmed Milk Pint': 1, 'Cheddar Cheese Medium 300g': 1, 'Tomatoes Fresh Vine 500g': 1, 'Carrots 1Kg': 1, 'Potatoes 600g': 1, 'Bacon 300g': 1,…
Luca
  • 31
  • 4
-2
votes
1 answer

How to delete files with specific names in windows 10 using batch file?

Could you please help me with a command for batch file to delete the files with Name of the file. I need to delete the files which are older than 6 months according to their File name. I need to schedule the script in Task scheduler, So it will…
-2
votes
1 answer

How to delete values from a list using a for loop in my code below?

b=[2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 0, 13, 0, 0, 0, 17, 0, 19, 0, 0, 0, 23, 0, 0, 0, 0, 0, 29, 0, 31, 0, 0, 0, 0, 0, 37, 0, 0, 0, 41, 0, 43, 0, 0, 0, 47, 0, 0, 0, 0, 0, 53, 0, 0, 0, 0, 0, 59, 0, 61, 0, 0, 0, 0, 0, 67, 0, 0, 0, 71, 0, 73, 0, 0, 0, 0,…
-2
votes
1 answer

Python3: How does del List[List.index('item')] work?

myList = ['hi', 'hello', 'wassup', 'hey'] del myList[myList.index('hi')] I do not understand how the second line worked.
Ayush
  • 49
  • 7
-2
votes
1 answer

Complete mail email format

I am running into trouble with my current program. I have created the template of how I want my program to run. I don't run into any problems. One tweak I would like to make to it is being able to remove a key from my dictionary once the value is…
-2
votes
3 answers

Python - IndexError: list index out of range even though checking if empty

I'm getting the IndexError: list index out of range on the following line of code: if tweetSplit[i] != "": in my code: tweetSplit = tweet.split(' ') for i in range(len(tweetSplit)): #print (i) if not tweetSplit: break if…
user1098432
  • 17
  • 1
  • 5
-2
votes
1 answer

Delete From Javascript array reorder

I am deleting from a javascript array. After the delete the array gets reordered. Array [ Object, Object, Object, Object, Object, Object ]; 0 Object d:17065 1 Object d:17156 2 Object d:17246 3 Object …
user3525290
  • 1,557
  • 2
  • 20
  • 47
-2
votes
3 answers

remove key from dictionary function

I am trying to create a void function that removes strings from a dictionary. I need to make sure that the key is in the dictionary and then that the value is in that specific key. This is what I have thus far, but there appears to be some sort of…
Bob Darren
  • 107
  • 1
  • 1
  • 5
-3
votes
3 answers

Python del and garbage collecting

First look at my Python code, s = [[1, 2], [3, 6], [9, 6]] t = s i = s[0] del i del t[0] There is three references for [2, 1]; t[0], s[0] and "i", so if we try and delete of them it shouldn't effect on [1,2] because [1,2] still has two another…
-3
votes
1 answer

Python seems to be automatically matching two lists, preventing me from separating them

# arranges a lists indexes from which ones have the maximum # value to which ones have the minimum value def sortIndex(L): I = [] original = L new = L for i in range(len(original)): I.append(original.index(max(new))) del…
Shahb M
  • 3
  • 1
-5
votes
2 answers

Pointers On C exercises 6.18-2, my solution does not work

I'm a c beginer. learning C via the book ,below is my solution to 6.18-2 write a fucton to delete substr from source string.It does not work. #include char *find_char(char const *source, char const *chars) { int offset = 0; if…
badii
  • 7
  • 3
-5
votes
3 answers

How to remove only one occurrence of a key in a dictionary in Python?

Suppose I have hand={"a":"2","p":"3","l":"1","e":"1","a":"13"} if i use del["a"] it removes all the occurrences, but how to delete only one occurrence?
vishu
  • 23
  • 7
-6
votes
1 answer

How to make an object indestructible even with force deletion?

How can I make an object such indestructible that even with using del reserved word (I think it means force deletion) it won't be deleted? I'm storing the objects in a list, like this: list = [obj1, obj2, obj3, obj4 ....] del list[0] I think I have…
mertyildiran
  • 6,477
  • 5
  • 32
  • 55
1 2 3
20
21