Click here to Skip to main content
15,885,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Here's the return of my function:




[['Musique', 'Shawn Phillips', '2018-08-24', '2018-08-24'], ['Musique', "L'avenue Royale fête l'été!", '2018-08-25', '2018-08-25'], ['Musique', 'Perséides musicales', '2018-08-03', '2018-08-03']


I have to use a loop to i can search all those index and replace all date like <pre> '2018-08-24'</pre> to an int and then replace all of those date with the int.

Now, the other function that i need to put in this one is actually the function thats returns the int(obtain_date(date)), this one actually works. So now im having a hard time using this function in the initial one so i can use a loop with it (im assuming) to replace all str of my date into int.


So the function that works is called obtain_date(date)

I have to put it in obtain_events Keep in my mind that this is a list of lists.



So my 2 functions involved are:

obtain_events()
obtain_date(date)

- obtain_date(date) goes in obtain_events()

Thanks!

What I have tried:

I've tried to use my obtain_date(date) in a loop like this:

year = '2018'
for liste in my_liste:                     #to reach my global list
          for element in liste:            # to reach every lists in my list
             if year in element:      #using '2018' as its in every str i modify
              element[5:] = obtain_date(date)          #[5:] = str after '2018
Posted
Updated 13-Oct-18 22:20pm
v2

1 solution

I gave you the answer yesterday in your original question: How do I extract a part of a string in a list and change it into an int.[^]. Please do not repost the same question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900