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.
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 5, 2023 ... Your code does not work because re.split takes a regular expression as its first argument. string.punctuation[:10] is !
The split method takes an optional separator, so you could split each “word” on the exponent character, getting two numeric strings. Calling int() on each of those gets you the integer value of each. In Python, the “^” character is not exponentiation.
May 30, 2024 ... It sounds like you're talking about behavior inside the script. So what you're saying doesn't make sense to me. Can you show some examples of ...
the cron job runs a second python script that actually run freebsd tar (bsdtar) as a 3rd process. simply put tar seems to run ok but the 2nd script (what invokes the tar command) hangs waiting for the data from bsdtar program and never gets back the tar output.
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.
The split method breaks a string on the supplied characters. So you start with months.split("\n"), which gets you the lines above as separate strings for use in your list comprehension. Considering the string " January (31 days)", your next expression is this
Jun 6, 2022 ... Here is my 'headache' for today. I could have a number of strings like this… string1 = "(FS22 > 15) && (FS22 < 46) || (FS33 > 0.0)" string2 ...
Posting code that isn’t even Python doesn’t convince us that you’ve actually tried to do this before asking us. :confusedfile1 = 'play (4).txt' # Get one file. # See if the file actually exists. if not exists(file1): print(f"ERROR: File {file1} does not exist") sys.exit() # Exit program.
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.
Jul 14, 2024 ... I wish a Python code would do it! Is there a solution? Stefan2 ... This is what I process with my program: Save to a json file, then ...