Skip to content

Passing two variables between functions

EDIT I have made huge mess! I’m sincerely sorry! Issue is not about last 2 print statement. Those were added when I run out of idea. Whole issue is about passing title and final_price form check_price to send_email and use them in body and subject. I’ve just hit brick wall and don’t know her…

NameError: name ‘__file__’ is not defined

I am trying to store the path of a script into a variable using: However, it keeps returning a name ‘__file__’ is not defined error. Answer Pretty sure you are running this in a terminal in the interactive Python as it is the only place (I’m aware of) to not have __file__. Also, if it was a …

Pandas – Duplicate Rows and Slice String

I’m trying to create duplicate rows during a dataframe on conditions. For example, I have this Dataframe. And I would like to get the following output: Answer For pandas 0.25+ is possible use DataFrame.explode with splitted values by Series.str.split and for remark column list comprehension with filteri…

Output tuple from a list without ‘for’

I need to output tuple from a list without for. Tell me please, how I can do it? I have list of all permutation for some n: and I need (for example, if n = 2) : I tried, to use sum(l, []), but I have not idea, how I can do line break. Answer What you get back from