input and print don't like parenthesesIs there a built-in function to print all the current properties and values of an object?How to flush output of print function?How to print colored text in terminal in Python?How to print a date in a regular format?How to print without newline or space?How to print number with commas as thousands separators?How to print the full traceback without halting the program?How can I print literal curly-brace characters in python string and also use .format on it?How to print to stderr in Python?What does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?
Pass By Reference VS Pass by Value
Apply MapThread to all but one variable
How do I reattach a shelf to the wall when it ripped out of the wall?
Please, smoke with good manners
French for 'It must be my imagination'?
How can I place the product on a social media post better?
How come there are so many candidates for the 2020 Democratic party presidential nomination?
Noun clause (singular all the time?)
Do I have an "anti-research" personality?
Will a top journal at least read my introduction?
What is the difference between `command a[bc]d` and `command `ab,cd`
How would one muzzle a full grown polar bear in the 13th century?
A Strange Latex Symbol
Is there really no use for MD5 anymore?
What do the phrase "Reeyan's seacrest" and the word "fraggle" mean in a sketch?
Why is it that the natural deduction method can't test for invalidity?
Does Gita support doctrine of eternal cycle of birth and death for evil people?
Why other Westeros houses don't use wildfire?
Binary Numbers Magic Trick
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Are Boeing 737-800’s grounded?
Who is the Umpire in this picture?
Can someone publish a story that happened to you?
How to type a section sign (§) into the Minecraft client
input and print don't like parentheses
Is there a built-in function to print all the current properties and values of an object?How to flush output of print function?How to print colored text in terminal in Python?How to print a date in a regular format?How to print without newline or space?How to print number with commas as thousands separators?How to print the full traceback without halting the program?How can I print literal curly-brace characters in python string and also use .format on it?How to print to stderr in Python?What does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have working knowledge of Python3, but I'm trying to adapt to a work environment that uses 2.7.2. Trying basic things, I can't get either input or print actions to work.
In 3.6.8 this works like so:
>> foo=("seven")
>> print("She lives with", foo, "small men")
She lives with seven small men
In my unix environment with 2.7.2, any variation using parentheses gives me a syntax error "(' is not expected". I can print without (), but I can't seem to find a way that works to assign and/or print the variable foo.
>> foo="seven"
>> print "She lives with", foo, "small men"
She lives with, foo, small men
Enclosing foo in the print statement with () [] or ++ all simply print whatever is typed into the code after "print".
Any help is appreciated.
python python-2.7
add a comment |
I have working knowledge of Python3, but I'm trying to adapt to a work environment that uses 2.7.2. Trying basic things, I can't get either input or print actions to work.
In 3.6.8 this works like so:
>> foo=("seven")
>> print("She lives with", foo, "small men")
She lives with seven small men
In my unix environment with 2.7.2, any variation using parentheses gives me a syntax error "(' is not expected". I can print without (), but I can't seem to find a way that works to assign and/or print the variable foo.
>> foo="seven"
>> print "She lives with", foo, "small men"
She lives with, foo, small men
Enclosing foo in the print statement with () [] or ++ all simply print whatever is typed into the code after "print".
Any help is appreciated.
python python-2.7
1
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
9
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
1
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23
add a comment |
I have working knowledge of Python3, but I'm trying to adapt to a work environment that uses 2.7.2. Trying basic things, I can't get either input or print actions to work.
In 3.6.8 this works like so:
>> foo=("seven")
>> print("She lives with", foo, "small men")
She lives with seven small men
In my unix environment with 2.7.2, any variation using parentheses gives me a syntax error "(' is not expected". I can print without (), but I can't seem to find a way that works to assign and/or print the variable foo.
>> foo="seven"
>> print "She lives with", foo, "small men"
She lives with, foo, small men
Enclosing foo in the print statement with () [] or ++ all simply print whatever is typed into the code after "print".
Any help is appreciated.
python python-2.7
I have working knowledge of Python3, but I'm trying to adapt to a work environment that uses 2.7.2. Trying basic things, I can't get either input or print actions to work.
In 3.6.8 this works like so:
>> foo=("seven")
>> print("She lives with", foo, "small men")
She lives with seven small men
In my unix environment with 2.7.2, any variation using parentheses gives me a syntax error "(' is not expected". I can print without (), but I can't seem to find a way that works to assign and/or print the variable foo.
>> foo="seven"
>> print "She lives with", foo, "small men"
She lives with, foo, small men
Enclosing foo in the print statement with () [] or ++ all simply print whatever is typed into the code after "print".
Any help is appreciated.
python python-2.7
python python-2.7
edited Mar 22 at 18:51
martineau
70.8k1093187
70.8k1093187
asked Mar 22 at 18:19
William CollinsWilliam Collins
11
11
1
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
9
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
1
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23
add a comment |
1
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
9
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
1
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23
1
1
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
9
9
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
1
1
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23
add a comment |
1 Answer
1
active
oldest
votes
This turned out to be an even simpler newbie problem and fix. In the unix environment, the script needs to be preceeded with "python" at the command line. I was lulled into complacency by working in Windows previously, where the command line only required the name of the script. (Windows applies some voodoo to know to run it as python, where in unix, that'snot the case.)
Saving the same code as "foo.py" and run command with "python" yields the correct result:
=> python foo.py
She lives with seven small men
Thanks for humoring a sheepish newbie.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55305681%2finput-and-print-dont-like-parentheses%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This turned out to be an even simpler newbie problem and fix. In the unix environment, the script needs to be preceeded with "python" at the command line. I was lulled into complacency by working in Windows previously, where the command line only required the name of the script. (Windows applies some voodoo to know to run it as python, where in unix, that'snot the case.)
Saving the same code as "foo.py" and run command with "python" yields the correct result:
=> python foo.py
She lives with seven small men
Thanks for humoring a sheepish newbie.
add a comment |
This turned out to be an even simpler newbie problem and fix. In the unix environment, the script needs to be preceeded with "python" at the command line. I was lulled into complacency by working in Windows previously, where the command line only required the name of the script. (Windows applies some voodoo to know to run it as python, where in unix, that'snot the case.)
Saving the same code as "foo.py" and run command with "python" yields the correct result:
=> python foo.py
She lives with seven small men
Thanks for humoring a sheepish newbie.
add a comment |
This turned out to be an even simpler newbie problem and fix. In the unix environment, the script needs to be preceeded with "python" at the command line. I was lulled into complacency by working in Windows previously, where the command line only required the name of the script. (Windows applies some voodoo to know to run it as python, where in unix, that'snot the case.)
Saving the same code as "foo.py" and run command with "python" yields the correct result:
=> python foo.py
She lives with seven small men
Thanks for humoring a sheepish newbie.
This turned out to be an even simpler newbie problem and fix. In the unix environment, the script needs to be preceeded with "python" at the command line. I was lulled into complacency by working in Windows previously, where the command line only required the name of the script. (Windows applies some voodoo to know to run it as python, where in unix, that'snot the case.)
Saving the same code as "foo.py" and run command with "python" yields the correct result:
=> python foo.py
She lives with seven small men
Thanks for humoring a sheepish newbie.
answered Apr 9 at 17:17
William CollinsWilliam Collins
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55305681%2finput-and-print-dont-like-parentheses%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
docs.python.org/2/tutorial/inputoutput.html Search for 'format' and follow the directions.
– Chris
Mar 22 at 18:21
9
If that's really the output of that code, then your python interpreter is broken.
– Aran-Fey
Mar 22 at 18:21
1
Not reproducible with Python 2.7.2.
– Taegyung
Mar 22 at 18:36
Are you sure the inner double quotes are really double quotes? Not smart quotes, single quotes, or escaped in some way? The comma after foo in your output suggests that "foo," is part of a string literal.
– snakecharmerb
Mar 22 at 18:58
I guess I'll lean toward the broken interpreter. Also having trouble with "import", etc. This is a big corporate server environment and I'm a long way away from the admin who loaded python in the first place, although I put in a request to have python3 installed. Hopefully that will help matters. Thanks.
– William Collins
Mar 25 at 16:23