Skip to content

Tag: python

How can I fix the list index out of range problem?

So I wanna fill NaN value of the pay date with the date one month after the join date. Join date Payday1 Okt’10 NaN Des’10 NaN My expectation output is: Join date Payday1 Okt’10 Nov’10 Des’10 Jan’11 I try this code: This code is error in this code month=months[months.index(…

Merge multiple key in dictionary with same values inside an array

I need to merge three dictionaries with array values into a single dict based on if they have same values inside the array. The dictionaries is like this: Then, the output would be like this: I’ve tried this: But it only works if the values isn’t a list or array. Any solution? Answer Given you use…

Set URL from list as header for looped items

So my code looks like this (example URLs): create an array with URLs urls = [‘https://www.javatpoint.com/what-is-a-webpage’, ‘https://www.javatpoint.com/welding’] starting the loop for url in urls: # Use requests to retrieve data from a given URL The output I’m getting is this (w…

Python lint issue : invalid escape sequence ‘/’

This is my python code line which is giving me invalid escape sequence ‘/’ lint issue. It is giving me out that error for all the backslash I used here . any idea how to resolve this ? Answer There’s two issues here: Since this is not a raw string, the backslashes are string escapes, not reg…