Skip to content

Tag: python-3.x

workbook save failing, not sure why

I apologize for the length of this. I am a relative Neophyte to Excel VBA and even more junior with Python. I have run into an issue with an error that occasionally occurs in python using OpenPyXl (just trying that for the first time). Background: I have a series of python scripts (12) running and querying an…

Python split function behaviour

returns This behaviour seems really strange to me. Why are blanks returned only for b and not a? Answer As was pointed out by others, the documented behavior of str.split explains your results. Since you specify sep to be ‘)’, split looks for the strings that surround it, and in the case of &#8216…

Failed to struct.pack connection name in python

I try to use struct.pack but i get the next exception when i run it: the code that i run: I try to send the connection_struct as str and also as a bytes using encode. Answer The {name_len}s in your connection_struct specifies that you will pass {name_len} number of chars so when you call struct.pack() the las…

List has an issue

My code is: I want the output to be a list from my inputs. Why is the output [True, True, True] when there are three inputs before typing ‘quit’? Answer Looking at Operator precedence, the assignment operator := is the lowest of them all. That means that python evaluated the != first and assigned …