Problem with split() command - Python Discussions
Apr 3, 2023 ... Please edit your code (pencil icon) to replace </> with ```. It does not read right as is.
Apr 3, 2023 ... Please edit your code (pencil icon) to replace </> with ```. It does not read right as is.
I’m updating some code so that it produces the same output with both Python 2.7 and Python 3.7 (in Windows). The code runs an external program using ‘subprocess’ and reads the program’s exit code.
Dec 7, 2022 ... split is a method of str , so it's text.split() , and that returns a list. Were you doing split(text) instead?
Jan 30, 2021 ... Likely it is your print statement. You have: print 'The average of the numbers is', average. In modern Python print() is a function, ...
Besides, your code is veeery hard to read and reason. My advice would be: try to split the code into some files. use meaningful names for variables that describe their function in code. try to avoid global variables as they introduce uncertainty.
Mar 7, 2024 ... ... function you can actually split the words into a list, so I tried doing that, and work with each word. C.o.d.e (Hudson) March 7, 2024, 10:00pm 2.
Indentation is how Python expresses the control flow. If we have an if-statement to do one set of commands (or, optionally, an alternative) then the indentation groups the commands. Example from your script
Apr 26, 2024 ... Please read the pinned topic that explains how to post code, then edit your post to replace the screen shot. About the Python Help category.
Feb 22, 2024 ... ... Update: SQL=" + sql) cursor.execute(sql) self.conn.commit(). But when the code is executed the program throws an error because after the ...
Jan 2, 2024 ... Alternatively, you could split each line on the separators line.split("\\") . Then for each piece, check if it is exactly the pattern to replace ...