The output generated based on my code does not match the output i desire - logic

this is the output desired
this is my code
but this output dosent match what i desire
idk what to do to ammend

Related

How to concatenate yt-dlp output of "--get-id" and "--get-title" flags on the same line

I am new to using yt-dlp and would like to have as a response to the command "yt-dlp --get-id --get-title <playlist_url>, both the output result of "--get-id", concatenated with the output result of "--get-title" on the same line.
When I run the above command, the results appear on two separate lines.
I would like someone's help because I need these results to put in an Excel spreadsheet, with the ID in one column and the title in another.
I've tried several other ways but without satisfactory results.
Thank you for any help.

Use Stop-Transcript to record only input

I want to use "Start-Transcript" command to record only the input in the VS-Code terminal in windows. Currently it records both input as well as the output. Also is there any better way to record just the input in the VS code terminal?
Use Get-History to obtain a list of all command lines that were submitted in the current session.
(Get-History).CommandLine outputs just the command lines, as strings.

Problems in apache-nifi about unescapeJson

I am using apache nifi to transform some data.
I have a string: He didn’t say, \"S\\\"top!\" ,and unescapeJson() give me this result: He didn’t say, "S"top!"
Is that right? My expected result is He didn’t say, "S\"top!".
If the function was designed to do so,then how can i get my expected result.
example:
input and output of ReplaceText
setting of ReplaceText
GetFile processor just read a file with content: He didn’t say, \"S\\\"top!\"
A workaround appears to be possible by changing the ReplaceText Replacement Value property to just ${'$1'}. In my sample, this produced the desired output, He didn't say, "S\"top!".
I do not yet fully understand why, but I believe it is related to evaluating the output of the search as a regex for the replace, where the backslashes are evaluated before unescapeJson() is applied, so it ends up being redundant. This does not happen if you set Replacement Value to just $1, for example.
Update
I had the order wrong above, the order of resolution is as follows:
Search returns: He didn’t say, \"S\\\"top!\"
Expression Language evaluates ${'$1':unescapeJson()} to: He didn’t say, "S\"top!"
Replace result is: He didn’t say, "S"top!"
So unescapeJson() is working as expected, and the behavior you are not expecting is that the remaining backslash is lost in the replace as an artifact of String::replaceAll().

Writing to a .txt file if input is not matching a certain format

My set task is to make my program write to a .txt file if the input entered is not matching the certain format,in this case being the format of a standard UK registration plate. However the outcome always seems to be only the first if statement, as if the 'else' is ignored. This is what it looks like.
import re
NumberP = open('NumberP.txt','a')
plate = 'AB12 ABC'
question = input('Please enter your number plate. ')
if re.match(r'^[A-Z][A-Z]\d\d [A-Z][A-Z][A-Z]$', plate):
print ("The Plate matches Standard UK Plate")
else:
print("ERROR")
Number.write(question)
NumberP.close()
If anyone can help me fix this would be great.

how to get html from plain formatted text?

I have an array that looks like
Ant run name : Basics of Edumate
Overall result : pass
Ant run took: 4 minutes 13 seconds
--------------------------
Details for all test suits
--------------------------
login : Pass
AddCycleTemplate: Pass
AddCycleTemplate: Pass
AddAcademicYear : Pass
AddAcademicYear : Pass
AddCampus : Pass
Is there any easy way how I can convert this in ruby into html that keeps the formatting?
If these are the only kinds of lines you will ever see, then you could certainly write a Ruby script that does the following:
First, output a doctype declaration, an opening html tag, an head section, an opening body tag, and an opening table tag with whatever style you like.
Read your Ant output line by line. If the line has a colon in it, split it on the colon and output a table row with two columns (each side of the split). If the line does not have a colon write its text as colspan=2, perhaps with a style indicating a large margin-top and margin-bottom, except if it is all dashes in which case you should ignore it.
Output HTML to close the table and the body.
This is certainly a hack and not a general solution by any means, but hey if you are writing a tool just for yourself so you can have some pretty little ant outputs, go for it. This is no more than 20 lines of Ruby. Write it to read from stdin and write to stdout so you can pipe your ant output to it!
if you don't care about formatting, just encapsulate the entire thing in <pre></pre> tags and you're set. All new lines and whitespaces will be preserved and default font is a monospaced one.

Resources