What does the prompt '...' in python 3 mean? [closed] - python-3.x

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
As an exercise we need to explain what happens when we leave an open paranthesesis in a print statement.
Doing so does not give us an error nor a value, the resulting line gives us a prompt consisting of dots instead of arrows. Does this situation/prompt have a name and can someone explain?
for example:
>>>print('Hello'
...

The official name is secondary prompt. It is used when inputting incomplete constructs, for example not closing any set of parentheses or when defining a function.

The three greater-than signs (>>>) prompts for the next command, which the interpreter can process at once. The three dots (...), in its turn, prompts the continuation lines, such as print(: interpreter can't process your command at once, because it, in this case, doesn't know the arguments you want to pass to the function.

Related

How to pass in '=' to a terminal command as is (Linux/macOS)? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to run a program via its CLI. The command is something like this:
./Program -t -s -variables Param1=Value1,Param2="Value2=SubValue"
However, the Param2 is not accepted by the program. How can I pass in the "Value2=Subvalue" as is?
It depends on how the program is parsing the command line arguments. My guess is that the program is setting Param1 equal to Value1,Param2=Value2=SubValue. Try a space between Param1 and Param2. What program is this? What does the documentation say?
Without knowing which command it's a bit difficult to know how it expects its parameters, but generally they are not separated by commas. Try removing that and putting a space there instead.

Script program inputs in bash ubuntu linux [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm in a course for C++ programming.
Our professor created a linux validation script against which our program output must match exactly.
It's running out of his own program and generates an output.txt file, then compares it against his output file, if it doesn't match it rejects the script.
The problem is, this program excepts probably 150-200 lines of input and if anything goes in wrong you have to start all over again. If you even enter an incorrect char, it must be restarted as the backspace registers as a character of its own.
How might I generate a bash script that would feed all of the input into the program automatically?
NOTE: We have to use his program as in: ~professor.name/submit asigname
You can create a text file:
answers.txt
answer1
answer2
...
answerN
and use that as stdin for the program:
./your_program < answers.txt
How might I generate a bash script that would feed all of the input into the program automatically?
Without any example code or input/output, it is hard to gauge what precisely is that you need.
Otherwise, for a generic tool to automate interactive console programs, I would suggest to take a look at the Expect.

Delete user defined commands in GDB [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have created few hooks and user defined commands in GDB. Now I just want to know How I can remove or change them.
Thanks,
I don't think there is a way to remove them. That seems like an oversight in the gdb command language.
You can redefine a user-defined command using the define command again. You can make your command a no-op by just defining the command to do nothing. gdb will ask if you really want to redefine a command:
(gdb) define qqq
Type commands for definition of "qqq".
End with a line saying just "end".
>print 23
>end
(gdb) define qqq
Redefine command "qqq"? (y or n) y
Type commands for definition of "qqq".
End with a line saying just "end".
>end

Python 3.3 Print('string', end='') [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Quick question, is there any difference between these two following bits of code?
Example 1
print("hello,", end='')
print(" world")
Example 2
print ("hello, world")
I don't see a difference in output, why would I use one over the other?
Thanks in advance for any answers
You would only really use the first one in cases where you may want to keep outputting things onto the same line (think logging something onto one line in a loop for some reason).
Otherwise use the simpler option.
If you use end='' it avoids the newline that python normally inserts in a print statement.
In practice, there's no reason to do it the first way with a short string like that, but if you wanted to put other variables in the output, it could be useful.

Simple String error, String breaking from ' in var [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
the parsing of user name has a ' inside of the user name
and i think that is causing the code to break
when i set it with this
tempUsername=Request.Form("UserName")
if (Request.Form("Action") = "Login") then
tempUsername=Request.Form("UserName")
tempPassword=Request.Form("UserPassword")
is that assumption right?
if so what is a solution to this?
Jumping onto the comment by James, as well as answering this question:
Input sanitization is an issue in every language. Even if there weren't ' characters in usernames, this code is danger++
At the very least, run all the data you get from Request.form through a function that escapes/sanitizes dangerous characters in the context of what the data is getting passed on to (such as data stores or dir-resolving code).
As for the code using <%, that's a sign this is an ASP script, and the syntax looks like it's VB. The (Request.Form("Action") = "Login") in particular is a dead give-away, because no sane programming language since the 80s uses "=" as an equality testing operator =)

Resources