Skip to content
Advertisement

Tag: python-3.x

Split string with unexpected behaviour?

I am reading a csv file and I use a split on every line but I do not fully understand the behavior. csv file: code: This yields: but I expected the last line to be: Answer Use the delimiter arg to csv.reader to split on semicolons instead of commas:

Using the gmail python API how can I get the most recent email that does not have a label “read”

this snippet gets the most recent email that has the arbitrary label “read”. How can I adapt it get the most recent email that does not have this label? replacing = with != doesn’t work for some reason returning the error: Answer Answer: Rather than using the labelIds parameter, you can use a Gmail search operator to do your query.

repeating a program using while loop failed

I coded a program that is meant to repeat itself over and over until the to_continue loop is broken by the input “N”. However, it didn’t seem to work. Output: whilst I meant for it to output Full program if that’s helpful: Any help would be deeply appreciated :) Please comment if any of the explanations are unclear or if

What is __peg_parser__ in Python?

I was using the keyword built-in module to get a list of all the keywords of the current Python version. And this is what I did: And in the keyword.kwlist list there is __peg_parser__. So to see what it does, I type __peg_parser__ in a Python 3.9 interpreter on Windows (you’ll get the same output on Mac OS and Linux

read and return text file with def function

i want to input the file name in this case books.txt and get the lines but i cant get it work, i have the files in the same directory but when i run this nothing happens, any way to fix this? or to call that function in another .py file but this return nothing and i dont know what to

Advertisement