Sep and End Arguments in print() statement - python-3.9

I am currently using Python 3.9.6 version and while using the print() statement with "sep=" as an argument, i am getting the syntax error.
My code for "Sep" Argument is:
print("John","Sam","Michael",sep="-")
My code for "End" Argument is:
print("John","Sam","Michael",end="-")
I don't understand what's the problem with my code. Please help
Please find the attached snippet of both the codes:enter image description here
enter image description here
Thanks in advance!!

Try using end.
Ex: print("John","Sam","Michael",end="-")

try this :
print("John","Sam","Michael",sep,"=","-")

Related

Selecting id attribute using xpath/scrapy

I am trying to select the user name from the following forum url.
However, when I use the following in the scrapy shell:
admin:~/workspace/scrapper (master) $ scrapy shell "https://bitcointalk.org/index.php?action=profile;u=22232"
In [1]: response.xpath('//*[#id='bodyarea']/table/tbody/tr/td/table/tbody/tr[2]/td[1]/table/tbody/tr[1]/td[2]')
File "<ipython-input-4-abe70514018b>", line 1
response.xpath('//*[#id='bodyarea']/table/tbody/tr/td/table/tbody/tr[2]/td[1]/table/tbody/tr[1]/td[2]')
^
SyntaxError: invalid syntax
However, in Chrome the selector works fine.
Any suggestions what I am doing wrong?
I appreciate your replies!
This is because of quotes inconsistent usage. Note that you're using single quotes both for XPath and string inside XPath.
Use either
'//*[#id="bodyarea"]/table...'
or
"//*[#id='bodyarea']/table..."

Hive error when declaring hivevar

Trying to declare a variable in Hive using Hue online. Using the following code:
SET hivevar:TABLE1=location.tablename;
I am getting the following error message:
Error while compiling statement: FAILED: ParseException line 1:12 missing KW_ROLE at 'hivevar' near 'hivevar' line 1:19 missing EOF at ':' near 'hivevar'.
Can anyone tell me what this error message means or even what the KW_ROLE statement means?
Do you by any chance have a comment above that instruction ? Are you running that line and that line only ?
For example, the following will raise a similar Exception :
--This is a comment
SET hivevar:TABLE1=location.tablename;
But it works fine without the comment.
I guess you are making changes in MAC/Windows and moving the script to the server, Double dash "--" in MAC is a different from double dash "--" on Linux server, make changes on server itself and run the script...

Prolog: using tell to create another .pl

So here is a method in my program where i want to write everything to the 'currentState.pl' however when i consult the file i get this error, line 27 is the tell() method. Any help would be greatly appreciated.
.pl:27:24: Syntax error: Operator expected
saveState:-
tell(‘currentState.pl’),
listing(on),
listing(left),
listing(holding),
told,
write('Current State Saved'),nl.
I think it should be tell('currentState.pl'), instead of tell(‘currentState.pl’), ' instead of ‘ or ’

MongoDB depends on ruby?

I tried to startup mongod and I get this type of errors:
/Users/myuser/.rvm/bin/ruby: line 6: /Users/myuser/.rvm/bin/ruby: Argument list too long
/Users/myuser/.rvm/bin/ruby: line 6: /Users/myuser/.rvm/bin/ruby: Undefined error: 0
Why does mongoDB need ruby? and what does this mean exactly...
Can you clarify what you mean by "simply running mongod"? What command line options are you specifying? Where are you seeing these errors - on stdout? In a log? What else are you seeing before you get these errors? A little more context like this will help us better understand the problem you're experiencing.

Execute sqlplus command in perl

I am trying to check sql connection via sqlplus command in perl.
I have used the following code to do this.
print "Befores\n";
$rc=system("sqlplus system/system #sqlfile.sql");
print "After $rc\n";
sleep(10);
The returnes value in rc is 0 this time. But when I give wrong credentials like. The sqlfile.sql file contains the only sql command 'EXIT'.
$rc=system("sqlplus systemabc/system #sqlfile.sql");
This also ends with the return code 0. But, manually doing the Credentials are wrong.
Help me out in solving this...
Thanks in advance. :)
Yes dear friens,,,
It's working fine now.
I just added '\' before #sqlfile.sql, i.e, I escaped the '#' symbol and I mentioned the database name after my password. Now I am getting the perfect output. :)
The change is as bellow:
$rc=system("sqlplus -L system/system#tstdb1 \#sqlfile.sql");
Here the format I used is:
sqlplus -L Uname/Password#DBName \#SqlFileContainingMySQLQuries
And -L Specifies not to reprompt for username or password if the initial connection does not succeed. For more info goto About SQLPLUS
I also tried without escaping the '#' symbol before sqlfile.sql, But the change also should apply for inverted comas, I used Single inverted comas instead of double inverted comas as bellow as mentioned by #René Nyffenegger :
$rc=system('sqlplus -L system/system#tstdb1 #sqlfile.sql');
Here the format I used is:
sqlplus Uname/Password#DBName #SqlFileContainingMySQLQuries
This also works fine.
Yeah... :) I too tried this, Thanks for the answer #user252025
I was doing:
$rc=system("sqlplus -L user/user \#sql_file.sql");
Da rtrn code was wrong for me
Now I ve changed to
$rc=system("sqlplus -L user/user#Mydb \#sql_file.sql");
Its working fine..
Thanks again...
The problem is the line
$rc=system("sqlplus system/system #sqlfile.sql");
You have a string quoted with double quotes ("..."). Such strings try to epxand variables (starting with #, $ and %). Since you have #sqlfile in the string, perl assumes this to be an array (which, of course it is not).
Remedy:
$rc=system('sqlplus system/system #sqlfile.sql');
Why are you doing this? DBI exists to provivide a sane and secure way of using databases and sensibly getting the output/return/errors from them.

Resources