Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: -> Help: erreur print
Post: RE: -> Help: erreur print

(Apr-08-2020, 07:51 PM)deanhystad Wrote: No. You need to call the function once to get the filename. Then you can use the returned filename as many times as you want. filename = saisie_nomf(list)...
cherry_cherry General Coding Help 4 2,719 Apr-09-2020, 05:05 AM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-08-2020, 07:45 PM)deanhystad Wrote: Was I understanding the problem wrong the entire time? In an early post you said this: "If If the list has a number of key "numero" duplicated, it does not...
cherry_cherry Homework 16 5,532 Apr-09-2020, 04:01 AM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-08-2020, 05:01 PM)deanhystad Wrote: Why did you change the code to create new_dict outside of check()? Why do you insist on not returning an empty diction while insisting that returning an emp...
cherry_cherry Homework 16 5,532 Apr-08-2020, 06:03 PM
    Thread: -> Help: erreur print
Post: RE: -> Help: erreur print

(Apr-08-2020, 05:19 PM)deanhystad Wrote: This calls your function that asks for all the input: saisie_nomf(list) Whenever you call this function you will have to type in a filename. This calls yo...
cherry_cherry General Coding Help 4 2,719 Apr-08-2020, 05:40 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-08-2020, 04:07 PM)deanhystad Wrote: It returns an empty dictionary. None is something different. Now this code is ok but when I use with other function, a new_dict isn't emty. And I did not fi...
cherry_cherry Homework 16 5,532 Apr-08-2020, 04:15 PM
    Thread: -> Help: erreur print
Post: -> Help: erreur print

Hi everyone, My project is to enter a json file or txt file. If it exists in my source then read the file entered and evaluate the condition. This condition: Create a new dictionary from the list in ...
cherry_cherry General Coding Help 4 2,719 Apr-08-2020, 03:51 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-08-2020, 03:29 PM)deanhystad Wrote: The condition in your first example does not return a new_dict when else. The else condition adds an entry to new_dict. Printing an error message does nothi...
cherry_cherry Homework 16 5,532 Apr-08-2020, 03:48 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-08-2020, 01:27 PM)deanhystad Wrote: That is not true. In your first example you created an empty dictionary and you returned a value. You know how to do both of those things, now just put the...
cherry_cherry Homework 16 5,532 Apr-08-2020, 02:13 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-07-2020, 05:29 PM)deanhystad Wrote: I am not asking what it should do, I am asking how you would do that. How could my function be modified to return an empty dictionary when it discovers a du...
cherry_cherry Homework 16 5,532 Apr-08-2020, 01:20 PM
    Thread: Sort a dict in dict
Post: RE: Sort a dict in dict

(Apr-07-2020, 09:57 PM)bowlofred Wrote: sorted(dico_nouveau.values(), key=lambda v: v['name']) Thank you for reply! I want 3 different sorts and the information output include the initial key and a ...
cherry_cherry General Coding Help 4 75,874 Apr-08-2020, 11:23 AM
    Thread: Sort a dict in dict
Post: Sort a dict in dict

Hi everyone, I want to sort by 'name' value, by 'notes' values and by average 'notes' values in a dictionary. I tried different methods but it didn't work. I have searched for a solution on google bu...
cherry_cherry General Coding Help 4 75,874 Apr-07-2020, 08:48 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-07-2020, 03:45 PM)deanhystad Wrote: How would you do that then? My example identifies a duplicate key but continues on and returns a dictionary. What change could you make to return (An empty...
cherry_cherry Homework 16 5,532 Apr-07-2020, 04:55 PM
    Thread: Dict from list - HELP! PLEASE!
Post: RE: Dict from list - HELP! PLEASE!

(Apr-07-2020, 09:36 AM)deanhystad Wrote: Unpack the list and check if the key value is already in the dictionary. def check(seq): new_dict = {} for i in seq: (key, value), *rest = i....
cherry_cherry Homework 16 5,532 Apr-07-2020, 11:18 AM
    Thread: Dict from list - HELP! PLEASE!
Post: Dict from list - HELP! PLEASE!

Hi, I consider the list under condition that if value of numero isn't duplicated, a new dict will be issued from a list with key is numero and value is another. But it's not valide in cases numero du...
cherry_cherry Homework 16 5,532 Apr-07-2020, 07:15 AM
    Thread: Convert dict from list - HELP! PLEASE!
Post: RE: Convert dict from list - HELP! PLEASE!

(Apr-06-2020, 06:34 PM)buran Wrote: data = [ {"numero":"20202020","name" : "Durand", "first":"Martin", "notes":[12,15.5,8,13]}, {"numero":"21212121","name" : "Dupond", "first":"Alain", "notes":[11,9...
cherry_cherry General Coding Help 4 2,767 Apr-06-2020, 06:39 PM
    Thread: Convert dict from list - HELP! PLEASE!
Post: RE: Convert dict from list - HELP! PLEASE!

(Apr-06-2020, 06:23 PM)deanhystad Wrote: What have you tried so far?Hi, Actually, It's part of my topic: I consider the list under condition that if value of numero isn't duplicated, a new dict wil...
cherry_cherry General Coding Help 4 2,767 Apr-06-2020, 06:33 PM
    Thread: Convert dict from list - HELP! PLEASE!
Post: Convert dict from list - HELP! PLEASE!

Hi everyone, I'm trying to transfer a list to a dictionnary and sort a new dict with key, but it's not success. This is a list I need transfer: [ {"numero":"20202020","name" : "Durand", "first":"Mar...
cherry_cherry General Coding Help 4 2,767 Apr-06-2020, 06:18 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020